Skip to content

Commit a89c384

Browse files
Avoid use of localhost in derby JDBC URL
1 parent 0f92f1c commit a89c384

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

jpa-idempotent-repository/src/test/java/org/acme/jpa/idempotent/repository/DerbyTestResource.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ public Map<String, String> start() {
5252
container.execInContainer("java", "-Djdbc.drivers=org.apache.derbbc.EmbeddedDriver",
5353
"org.apache.derby.tools.ij", "/init.sql");
5454

55-
return CollectionHelper.mapOf("quarkus.datasource.jdbc.url",
56-
"jdbc:derby://localhost:" + container.getMappedPort(DERBY_PORT) + "/my-db", "timer.period", "100",
57-
"timer.delay",
58-
"0", "timer.repeatCount", "4");
55+
String url = "jdbc:derby://%s:%d/my-db".formatted(container.getHost(), container.getMappedPort(DERBY_PORT));
56+
return CollectionHelper.mapOf(
57+
"quarkus.datasource.jdbc.url", url,
58+
"timer.period", "100",
59+
"timer.delay", "0",
60+
"timer.repeatCount", "4");
5961
} catch (Exception e) {
6062
LOGGER.error("An error occurred while starting the derby container", e);
6163
throw new RuntimeException(e);

0 commit comments

Comments
 (0)