From b706000e2904652f60d4fe8b332f7821b41de992 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Thu, 8 Jun 2023 23:05:50 +0200 Subject: [PATCH 1/2] [CI] Fix test support --- common/function-test-support/pom.xml | 11 +++++++++++ common/mongodb-common/pom.xml | 1 + consumer/cassandra-consumer/pom.xml | 1 + consumer/elasticsearch-consumer/pom.xml | 2 +- consumer/mongodb-consumer/pom.xml | 1 + function/aggregator-function/pom.xml | 1 + spring-functions-parent/pom.xml | 11 +++++++++-- supplier/mongodb-supplier/pom.xml | 1 + 8 files changed, 26 insertions(+), 3 deletions(-) diff --git a/common/function-test-support/pom.xml b/common/function-test-support/pom.xml index e5f67fe9..cbd42ee9 100644 --- a/common/function-test-support/pom.xml +++ b/common/function-test-support/pom.xml @@ -43,18 +43,29 @@ org.apache.sshd sshd-sftp ${sshd-sftp.version} + compile + + + org.junit.jupiter + junit-jupiter + compile org.testcontainers testcontainers + ${testcontainers.version} + compile org.testcontainers junit-jupiter + ${testcontainers.version} + compile org.awaitility awaitility + compile diff --git a/common/mongodb-common/pom.xml b/common/mongodb-common/pom.xml index 1eaeb2c3..3b62ba45 100644 --- a/common/mongodb-common/pom.xml +++ b/common/mongodb-common/pom.xml @@ -18,6 +18,7 @@ org.testcontainers mongodb + ${testcontainers.version} test diff --git a/consumer/cassandra-consumer/pom.xml b/consumer/cassandra-consumer/pom.xml index 9e7de98e..f906614f 100644 --- a/consumer/cassandra-consumer/pom.xml +++ b/consumer/cassandra-consumer/pom.xml @@ -26,6 +26,7 @@ org.testcontainers cassandra + ${testcontainers.version} test diff --git a/consumer/elasticsearch-consumer/pom.xml b/consumer/elasticsearch-consumer/pom.xml index fb00f8af..17042c12 100644 --- a/consumer/elasticsearch-consumer/pom.xml +++ b/consumer/elasticsearch-consumer/pom.xml @@ -41,7 +41,7 @@ org.testcontainers elasticsearch - ${test-containers.version} + ${testcontainers.version} test diff --git a/consumer/mongodb-consumer/pom.xml b/consumer/mongodb-consumer/pom.xml index fd3d274d..1a5ffba9 100644 --- a/consumer/mongodb-consumer/pom.xml +++ b/consumer/mongodb-consumer/pom.xml @@ -26,6 +26,7 @@ org.testcontainers mongodb + ${testcontainers.version} test diff --git a/function/aggregator-function/pom.xml b/function/aggregator-function/pom.xml index 57a24503..6a8d350f 100644 --- a/function/aggregator-function/pom.xml +++ b/function/aggregator-function/pom.xml @@ -37,6 +37,7 @@ org.testcontainers mongodb + ${testcontainers.version} test diff --git a/spring-functions-parent/pom.xml b/spring-functions-parent/pom.xml index 0a7bdb11..26c6221c 100644 --- a/spring-functions-parent/pom.xml +++ b/spring-functions-parent/pom.xml @@ -56,6 +56,11 @@ spring-boot-starter-test test + + org.junit.jupiter + junit-jupiter + test + org.springframework.integration spring-integration-test @@ -68,12 +73,14 @@ org.testcontainers - junit-jupiter + testcontainers + ${testcontainers.version} test org.testcontainers - testcontainers + junit-jupiter + ${testcontainers.version} test diff --git a/supplier/mongodb-supplier/pom.xml b/supplier/mongodb-supplier/pom.xml index 465671b9..0b37beca 100644 --- a/supplier/mongodb-supplier/pom.xml +++ b/supplier/mongodb-supplier/pom.xml @@ -36,6 +36,7 @@ org.testcontainers mongodb + ${testcontainers.version} test From cda31807818ad81cdbbfb37b05f99321e2efd7b9 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Thu, 8 Jun 2023 23:10:59 +0200 Subject: [PATCH 2/2] Restore change for Mongo Tests. --- .../cloud/fn/common/mongo/MongoDbTestContainerSupport.java | 2 +- .../fn/consumer/mongo/MongoDbConsumerApplicationTests.java | 2 +- .../CustomPropsAndMongoMessageStoreAggregatorTests.java | 2 +- .../fn/supplier/mongo/MongodbSupplierApplicationTests.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/mongodb-common/src/test/java/org/springframework/cloud/fn/common/mongo/MongoDbTestContainerSupport.java b/common/mongodb-common/src/test/java/org/springframework/cloud/fn/common/mongo/MongoDbTestContainerSupport.java index 348fd361..8848a342 100644 --- a/common/mongodb-common/src/test/java/org/springframework/cloud/fn/common/mongo/MongoDbTestContainerSupport.java +++ b/common/mongodb-common/src/test/java/org/springframework/cloud/fn/common/mongo/MongoDbTestContainerSupport.java @@ -30,7 +30,7 @@ import org.testcontainers.junit.jupiter.Testcontainers; @Testcontainers(disabledWithoutDocker = true) public interface MongoDbTestContainerSupport { - MongoDBContainer MONGO_CONTAINER = new MongoDBContainer("mongo:5.0.9") + MongoDBContainer MONGO_CONTAINER = new MongoDBContainer("mongo:6.0.6") .withStartupTimeout(Duration.ofSeconds(120)) .withStartupAttempts(3); @BeforeAll diff --git a/consumer/mongodb-consumer/src/test/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerApplicationTests.java b/consumer/mongodb-consumer/src/test/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerApplicationTests.java index 60f8580c..b5f43bfc 100644 --- a/consumer/mongodb-consumer/src/test/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerApplicationTests.java +++ b/consumer/mongodb-consumer/src/test/java/org/springframework/cloud/fn/consumer/mongo/MongoDbConsumerApplicationTests.java @@ -51,7 +51,7 @@ class MongoDbConsumerApplicationTests implements MongoDbTestContainerSupport { @DynamicPropertySource static void mongoDbProperties(DynamicPropertyRegistry registry) { - registry.add("spring.data.mongodb.uri", MongoDbTestContainerSupport::mongoDbUri); + registry.add("spring.data.mongodb.port", MONGO_CONTAINER::getFirstMappedPort); registry.add("spring.data.mongodb.database", () -> "test"); } diff --git a/function/aggregator-function/src/test/java/org/springframework/cloud/fn/aggregator/CustomPropsAndMongoMessageStoreAggregatorTests.java b/function/aggregator-function/src/test/java/org/springframework/cloud/fn/aggregator/CustomPropsAndMongoMessageStoreAggregatorTests.java index d876303f..abbc4b66 100644 --- a/function/aggregator-function/src/test/java/org/springframework/cloud/fn/aggregator/CustomPropsAndMongoMessageStoreAggregatorTests.java +++ b/function/aggregator-function/src/test/java/org/springframework/cloud/fn/aggregator/CustomPropsAndMongoMessageStoreAggregatorTests.java @@ -51,7 +51,7 @@ public class CustomPropsAndMongoMessageStoreAggregatorTests extends AbstractAggr @DynamicPropertySource static void mongoDbProperties(DynamicPropertyRegistry registry) { - registry.add("spring.data.mongodb.uri", MongoDbTestContainerSupport::mongoDbUri); + registry.add("spring.data.mongodb.port", MONGO_CONTAINER::getFirstMappedPort); registry.add("spring.data.mongodb.database", () -> "test"); } diff --git a/supplier/mongodb-supplier/src/test/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierApplicationTests.java b/supplier/mongodb-supplier/src/test/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierApplicationTests.java index 9137cfbd..dd9189f8 100644 --- a/supplier/mongodb-supplier/src/test/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierApplicationTests.java +++ b/supplier/mongodb-supplier/src/test/java/org/springframework/cloud/fn/supplier/mongo/MongodbSupplierApplicationTests.java @@ -50,7 +50,7 @@ class MongodbSupplierApplicationTests implements MongoDbTestContainerSupport { @DynamicPropertySource static void mongoDbProperties(DynamicPropertyRegistry registry) { - registry.add("spring.data.mongodb.uri", MongoDbTestContainerSupport::mongoDbUri); + registry.add("spring.data.mongodb.port", MONGO_CONTAINER::getFirstMappedPort); registry.add("spring.data.mongodb.database", () -> "test"); }