From d4481212cf426173fd1176383452a91b209ffcbc Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Tue, 18 Nov 2025 15:06:08 +0000 Subject: [PATCH 1/4] Use dev services instead of external container for DB2 --- .../hibernate-reactive-db2/pom.xml | 101 ++--------------- .../src/main/resources/application.properties | 3 - .../container-license-acceptance.txt | 1 + integration-tests/jpa-db2/README.md | 2 +- integration-tests/jpa-db2/pom.xml | 91 ++-------------- .../src/main/resources/application.properties | 3 - .../container-license-acceptance.txt | 1 + .../reactive-db2-client/README.md | 6 +- integration-tests/reactive-db2-client/pom.xml | 102 ++---------------- .../src/main/resources/application.properties | 6 -- .../container-license-acceptance.txt | 1 + 11 files changed, 25 insertions(+), 292 deletions(-) create mode 100644 integration-tests/hibernate-reactive-db2/src/test/resources/container-license-acceptance.txt create mode 100644 integration-tests/jpa-db2/src/test/resources/container-license-acceptance.txt create mode 100644 integration-tests/reactive-db2-client/src/test/resources/container-license-acceptance.txt diff --git a/integration-tests/hibernate-reactive-db2/pom.xml b/integration-tests/hibernate-reactive-db2/pom.xml index aa276b492d382..58c3c27762ba1 100644 --- a/integration-tests/hibernate-reactive-db2/pom.xml +++ b/integration-tests/hibernate-reactive-db2/pom.xml @@ -13,10 +13,6 @@ Quarkus - Integration Tests - Hibernate Reactive - DB2 Hibernate Reactive related tests running with the DB2 database - - vertx-reactive:db2://localhost:50005/hreact - - io.quarkus @@ -92,6 +88,12 @@ true + + + src/test/resources + true + + maven-surefire-plugin @@ -151,97 +153,6 @@ - - docker-db2 - - - start-containers - - - - - - io.fabric8 - docker-maven-plugin - - - - ${db2.image} - quarkus-test-db2 - - - bridge - - true - - 50005:50000 - - - hreact - hreact - hreact - accept - - false - false - false - - - DB2: - default - cyan - - - - .*INSTANCE.* - - - - 300000 - - - - - - - - docker-start - compile - - stop - start - - - - docker-stop - post-integration-test - - stop - - - - - - org.codehaus.mojo - exec-maven-plugin - - - docker-prune - generate-resources - - exec - - - ${docker-prune.location} - - - - - - - diff --git a/integration-tests/hibernate-reactive-db2/src/main/resources/application.properties b/integration-tests/hibernate-reactive-db2/src/main/resources/application.properties index a0cffef814700..18dfb380978ee 100644 --- a/integration-tests/hibernate-reactive-db2/src/main/resources/application.properties +++ b/integration-tests/hibernate-reactive-db2/src/main/resources/application.properties @@ -1,6 +1,4 @@ quarkus.datasource.db-kind=db2 -quarkus.datasource.username=hreact -quarkus.datasource.password=hreact # Hibernate config #quarkus.hibernate-orm.log.sql=true @@ -8,4 +6,3 @@ quarkus.hibernate-orm.schema-management.strategy=drop-and-create # Reactive config quarkus.datasource.reactive=true -quarkus.datasource.reactive.url=${reactive-db2.url} diff --git a/integration-tests/hibernate-reactive-db2/src/test/resources/container-license-acceptance.txt b/integration-tests/hibernate-reactive-db2/src/test/resources/container-license-acceptance.txt new file mode 100644 index 0000000000000..62d2b5ed5f19e --- /dev/null +++ b/integration-tests/hibernate-reactive-db2/src/test/resources/container-license-acceptance.txt @@ -0,0 +1 @@ +${db2.image} diff --git a/integration-tests/jpa-db2/README.md b/integration-tests/jpa-db2/README.md index cea80540c61a0..ef2a26ea6e768 100644 --- a/integration-tests/jpa-db2/README.md +++ b/integration-tests/jpa-db2/README.md @@ -4,7 +4,7 @@ By default, the tests of this module are disabled. -To run the tests in a standard JVM with DB2 started as a Docker container, you can run the following command: +To run the tests in a standard JVM with DB2 started as a Dev Service, you can run the following command: ``` mvn verify -Dtest-containers -Dstart-containers diff --git a/integration-tests/jpa-db2/pom.xml b/integration-tests/jpa-db2/pom.xml index 37a651b7bc64e..1b7ed8c202589 100644 --- a/integration-tests/jpa-db2/pom.xml +++ b/integration-tests/jpa-db2/pom.xml @@ -13,10 +13,6 @@ Quarkus - Integration Tests - JPA - DB2 Module that contains JPA related tests running with the DB2 database - - jdbc:db2://localhost:50005/hreact - - io.quarkus @@ -101,6 +97,12 @@ true + + + src/test/resources + true + + maven-surefire-plugin @@ -162,87 +164,6 @@ - - - io.fabric8 - docker-maven-plugin - - - - ${db2.image} - quarkus-test-db2 - - - bridge - - true - - 50005:50000 - - - hreact - hreact - hreact - accept - - false - false - false - - - DB2: - default - cyan - - - - .*INSTANCE.* - - - - 300000 - - - - - - - - docker-start - compile - - stop - start - - - - docker-stop - post-integration-test - - stop - - - - - - org.codehaus.mojo - exec-maven-plugin - - - docker-prune - generate-resources - - exec - - - ${docker-prune.location} - - - - - diff --git a/integration-tests/jpa-db2/src/main/resources/application.properties b/integration-tests/jpa-db2/src/main/resources/application.properties index aef7bf3e54452..0696204646917 100644 --- a/integration-tests/jpa-db2/src/main/resources/application.properties +++ b/integration-tests/jpa-db2/src/main/resources/application.properties @@ -1,5 +1,2 @@ quarkus.datasource.db-kind=db2 -quarkus.datasource.username=hreact -quarkus.datasource.password=hreact -quarkus.datasource.jdbc.url=${jdbc-db2.url} quarkus.hibernate-orm.schema-management.strategy=drop-and-create \ No newline at end of file diff --git a/integration-tests/jpa-db2/src/test/resources/container-license-acceptance.txt b/integration-tests/jpa-db2/src/test/resources/container-license-acceptance.txt new file mode 100644 index 0000000000000..62d2b5ed5f19e --- /dev/null +++ b/integration-tests/jpa-db2/src/test/resources/container-license-acceptance.txt @@ -0,0 +1 @@ +${db2.image} diff --git a/integration-tests/reactive-db2-client/README.md b/integration-tests/reactive-db2-client/README.md index 6bfe5101bf0ce..a704f066b7d73 100644 --- a/integration-tests/reactive-db2-client/README.md +++ b/integration-tests/reactive-db2-client/README.md @@ -4,7 +4,7 @@ By default, the tests of this module are disabled. -To run the tests in a standard JVM with DB2 started as a Docker container, you can run the following command: +To run the tests in a standard JVM with DB2 started as a Dev Service, you can run the following command: ``` mvn verify -Dtest-containers -Dstart-containers @@ -16,7 +16,7 @@ Additionally, you can generate a native image and run the tests for this native mvn verify -Dtest-containers -Dstart-containers -Dnative ``` -If you don't want to run DB2 as a Docker container, you can start your own DB2 server. It needs to listen on the default port (50005) and have a database called `hreact` accessible to the user `hreact` with the password `hreact`. +If you don't want to run DB2 as a Dev Service, you can start your own DB2 server. It needs to listen on the default port (50005) and have a database called `hreact` accessible to the user `hreact` with the password `hreact`. You can then run the tests as follows (either with `-Dnative` or not): @@ -24,4 +24,4 @@ You can then run the tests as follows (either with `-Dnative` or not): mvn verify -Dtest-containers ``` -If you have specific requirements, you can define a specific connection URL with `-Dreactive-db2.url=vertx-reactive:db2://localhost:50000/hreact`. +If you have specific requirements, you can define a specific connection URL with `-Dquarkus.datasource.reactive.url=vertx-reactive:db2://localhost:50000/hreact`. diff --git a/integration-tests/reactive-db2-client/pom.xml b/integration-tests/reactive-db2-client/pom.xml index be222298d55c8..6f2e4f923ff4b 100644 --- a/integration-tests/reactive-db2-client/pom.xml +++ b/integration-tests/reactive-db2-client/pom.xml @@ -14,10 +14,6 @@ Quarkus - Integration Tests - Reactive DB2 Client - - vertx-reactive:db2://localhost:50005/hreact - - io.quarkus @@ -92,6 +88,12 @@ true + + + src/test/resources + true + + maven-surefire-plugin @@ -144,98 +146,6 @@ - - - docker-db2 - - - start-containers - - - - - - io.fabric8 - docker-maven-plugin - - - - ${db2.image} - quarkus-test-db2 - - - bridge - - true - - 50005:50000 - - - hreact - hreact - hreact - accept - - false - false - false - - - DB2: - default - cyan - - - - .*INSTANCE.* - - - - 300000 - - - - - - - - docker-start - compile - - stop - start - - - - docker-stop - post-integration-test - - stop - - - - - - org.codehaus.mojo - exec-maven-plugin - - - docker-prune - generate-resources - - exec - - - ${docker-prune.location} - - - - - - - diff --git a/integration-tests/reactive-db2-client/src/main/resources/application.properties b/integration-tests/reactive-db2-client/src/main/resources/application.properties index 928990ac3ed91..b40827eade98f 100644 --- a/integration-tests/reactive-db2-client/src/main/resources/application.properties +++ b/integration-tests/reactive-db2-client/src/main/resources/application.properties @@ -1,9 +1,3 @@ quarkus.datasource.db-kind=db2 -quarkus.datasource.username=hreact -quarkus.datasource.password=hreact -quarkus.datasource.reactive.url=${reactive-db2.url} quarkus.datasource."additional".db-kind=db2 -quarkus.datasource."additional".username=hreact -quarkus.datasource."additional".password=hreact -quarkus.datasource."additional".reactive.url=${reactive-db2.url} diff --git a/integration-tests/reactive-db2-client/src/test/resources/container-license-acceptance.txt b/integration-tests/reactive-db2-client/src/test/resources/container-license-acceptance.txt new file mode 100644 index 0000000000000..62d2b5ed5f19e --- /dev/null +++ b/integration-tests/reactive-db2-client/src/test/resources/container-license-acceptance.txt @@ -0,0 +1 @@ +${db2.image} From dcee6430f2431f8fe6fd4bd340660e3ac6471f83 Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Fri, 21 Nov 2025 16:38:48 +0000 Subject: [PATCH 2/4] Try shorter datasource name --- .../java/io/quarkus/it/reactive/db2/client/PlantResource.java | 2 +- .../src/main/resources/application.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java b/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java index 107f1b37713ab..91a0806459125 100644 --- a/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java +++ b/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java @@ -20,7 +20,7 @@ public class PlantResource { Pool client; @Inject - @ReactiveDataSource("additional") + @ReactiveDataSource("extra") Pool additionalClient; @PostConstruct diff --git a/integration-tests/reactive-db2-client/src/main/resources/application.properties b/integration-tests/reactive-db2-client/src/main/resources/application.properties index b40827eade98f..06124467a3967 100644 --- a/integration-tests/reactive-db2-client/src/main/resources/application.properties +++ b/integration-tests/reactive-db2-client/src/main/resources/application.properties @@ -1,3 +1,3 @@ quarkus.datasource.db-kind=db2 -quarkus.datasource."additional".db-kind=db2 +quarkus.datasource."extra".db-kind=db2 From 27f85959eb7e932bec7659db04bdec9e324a3e5e Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Fri, 21 Nov 2025 18:41:57 +0000 Subject: [PATCH 3/4] Diagnostics --- .../it/reactive/db2/client/PlantResource.java | 25 +++++++++++++------ .../it/reactive/db2/client/QueryTest.java | 4 +-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java b/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java index 91a0806459125..49815b5e32a67 100644 --- a/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java +++ b/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java @@ -34,14 +34,25 @@ void setupDb() { .flatMap(r -> client.query("INSERT INTO fruits (name) VALUES ('Apple')").execute()) .await().indefinitely(); + System.out.println("DEBUG setupDb"); additionalClient.query("DROP TABLE IF EXISTS vegetables").execute() .flatMap(r -> client - .query("CREATE TABLE legumes (id INTEGER NOT NULL GENERATED AS IDENTITY, name VARCHAR(50) NOT NULL)") + .query("CREATE TABLE veg (id INTEGER NOT NULL GENERATED AS IDENTITY, name VARCHAR(50) NOT NULL)") .execute()) - .flatMap(r -> client.query("INSERT INTO legumes (name) VALUES ('Cumcumber')").execute()) - .flatMap(r -> client.query("INSERT INTO legumes (name) VALUES ('Broccoli')").execute()) - .flatMap(r -> client.query("INSERT INTO legumes (name) VALUES ('Leeks')").execute()) + .flatMap(r -> client.query("INSERT INTO veg (name) VALUES ('Cumcumber')").execute()) + .flatMap(r -> client.query("INSERT INTO veg (name) VALUES ('Broccoli')").execute()) + .flatMap(r -> client.query("INSERT INTO veg (name) VALUES ('Leeks')").execute()) .await().indefinitely(); + System.out.println("DEBUG done setupDb"); + additionalClient.query("SELECT * FROM veg ORDER BY name").execute() + .map(rowSet -> { + JsonArray jsonArray = new JsonArray(); + for (Row row : rowSet) { + jsonArray.add(toJson(row)); + } + return jsonArray; + }).invoke(a -> System.out.println("DEBUG db contents " + a.encodePrettily())); + } @GET @@ -59,9 +70,9 @@ public CompletionStage listFruits() { } @GET - @Path("/legumes/") - public CompletionStage listLegumes() { - return additionalClient.query("SELECT * FROM legumes ORDER BY name").execute() + @Path("/veg/") + public CompletionStage listveg() { + return additionalClient.query("SELECT * FROM veg ORDER BY name").execute() .map(rowSet -> { JsonArray jsonArray = new JsonArray(); for (Row row : rowSet) { diff --git a/integration-tests/reactive-db2-client/src/test/java/io/quarkus/it/reactive/db2/client/QueryTest.java b/integration-tests/reactive-db2-client/src/test/java/io/quarkus/it/reactive/db2/client/QueryTest.java index 1066f5405dd43..1f6dc85dca698 100644 --- a/integration-tests/reactive-db2-client/src/test/java/io/quarkus/it/reactive/db2/client/QueryTest.java +++ b/integration-tests/reactive-db2-client/src/test/java/io/quarkus/it/reactive/db2/client/QueryTest.java @@ -23,9 +23,9 @@ public void testListAllFruits() { } @Test - public void testListAllLegumes() { + public void testListAllveg() { given() - .when().get("/plants/legumes/") + .when().get("/plants/veg/") .then() .statusCode(200) .body( From 57bde29e9a99b2e16fecd537f06f2798b777b24a Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Fri, 21 Nov 2025 19:21:54 +0000 Subject: [PATCH 4/4] More diagnostics --- .../io/quarkus/it/reactive/db2/client/PlantResource.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java b/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java index 49815b5e32a67..ee5d88dd3e3d0 100644 --- a/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java +++ b/integration-tests/reactive-db2-client/src/main/java/io/quarkus/it/reactive/db2/client/PlantResource.java @@ -52,6 +52,7 @@ void setupDb() { } return jsonArray; }).invoke(a -> System.out.println("DEBUG db contents " + a.encodePrettily())); + System.out.println("DEBUG done diagnostic query"); } @@ -72,6 +73,11 @@ public CompletionStage listFruits() { @GET @Path("/veg/") public CompletionStage listveg() { + try { + Thread.sleep(30 * 1000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } return additionalClient.query("SELECT * FROM veg ORDER BY name").execute() .map(rowSet -> { JsonArray jsonArray = new JsonArray();