From dd79824f75b72ee394bb1fab6b41ed19cb898991 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Oct 2021 09:14:56 +0000 Subject: [PATCH 1/7] Bump testcontainers-bom from 1.16.0 to 1.16.1 Bumps [testcontainers-bom](https://github.com/testcontainers/testcontainers-java) from 1.16.0 to 1.16.1. - [Release notes](https://github.com/testcontainers/testcontainers-java/releases) - [Changelog](https://github.com/testcontainers/testcontainers-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.16.0...1.16.1) --- updated-dependencies: - dependency-name: org.testcontainers:testcontainers-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 079a262d0429..70113296ab4a 100644 --- a/pom.xml +++ b/pom.xml @@ -115,7 +115,7 @@ 2.1.1.RELEASE 1.2.5 1.2.5 - 1.16.0 + 1.16.1 2.4.7 3.1.8.Final From 10f1f2bd5f774c92ef006a6cd4d1b44859837cbb Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 21 Oct 2021 15:38:23 +1000 Subject: [PATCH 2/7] use mongodb testcontainer module and upgrade a bit mongodb version Signed-off-by: Olivier Lamy --- pom.xml | 2 +- tests/test-sessions/test-mongodb-sessions/pom.xml | 7 ++++++- .../eclipse/jetty/nosql/mongodb/MongoTestHelper.java | 10 ++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 70113296ab4a..f0226d064d21 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ 3.8.2 0.13.1 1.7.2 - 2.13.2 + 3.2.2 0.9.1 8.0.1 6.0.0 diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index 781c1adbddfb..8d138455629c 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -12,7 +12,7 @@ ${project.groupId}.sessions.mongo localhost - 2.2.7 + 3.2.20 @@ -118,6 +118,11 @@ junit-jupiter test + + org.testcontainers + mongodb + test + org.slf4j slf4j-simple diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java index ef3f81887984..f7a010236eb3 100644 --- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java @@ -30,8 +30,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.MongoDBContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; +import org.testcontainers.utility.DockerImageName; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -50,10 +52,10 @@ public class MongoTestHelper private static final int MONGO_PORT = 27017; - static GenericContainer mongo = - new GenericContainer("mongo:" + System.getProperty("mongo.docker.version", "2.2.7")) - .withLogConsumer(new Slf4jLogConsumer(MONGO_LOG)) - .withExposedPorts(MONGO_PORT); + static MongoDBContainer mongo = + //new GenericContainer("mongo:" + System.getProperty("mongo.docker.version", "2.2.7")) + new MongoDBContainer(DockerImageName.parse("mongo:" + System.getProperty("mongo.docker.version", "3.2.20"))) + .withLogConsumer(new Slf4jLogConsumer(MONGO_LOG)); static MongoClient mongoClient; From b9329eb152dc8f2e5d63e44bbf74e916f09a0478 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 21 Oct 2021 20:46:34 +1000 Subject: [PATCH 3/7] give it more time to start Signed-off-by: Olivier Lamy --- .../session/HazelcastSessionDistributionTests.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java index f9ef069f0908..952a3366a1ac 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java @@ -20,6 +20,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.time.Duration; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -60,9 +61,9 @@ public class HazelcastSessionDistributionTests extends AbstractSessionDistributi @BeforeEach public void setupHazelcast() { - hazelcast = new GenericContainer<>("hazelcast/hazelcast:" + System.getProperty("hazelcast.version", "4.1")) + hazelcast = new GenericContainer<>("hazelcast/hazelcast:" + System.getProperty("hazelcast.version", "4.2.2")) .withExposedPorts(5701) - .waitingFor(Wait.forListeningPort()) + .waitingFor(Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(120L))) .withLogConsumer(new Slf4jLogConsumer(HAZELCAST_LOG)); } From bf7dd71ccead97fbb6a2d0fb1793bbee5ab6d900 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 22 Oct 2021 10:50:05 +1000 Subject: [PATCH 4/7] use mongo image from test container api for distribution test Signed-off-by: Olivier Lamy --- pom.xml | 2 ++ tests/test-distribution/pom.xml | 5 +++++ .../session/MongodbSessionDistributionTests.java | 13 ++++++++----- tests/test-sessions/test-mongodb-sessions/pom.xml | 2 -- .../jetty/nosql/mongodb/MongoTestHelper.java | 1 - 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index f0226d064d21..62bea4bb8668 100644 --- a/pom.xml +++ b/pom.xml @@ -169,6 +169,8 @@ -Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US -showversion -Xmx4g -Xms2g -Xlog:gc:stderr:time,level,tags false /tmp + + 3.2.20 src/it/settings.xml 0 diff --git a/tests/test-distribution/pom.xml b/tests/test-distribution/pom.xml index 9cbe571d6745..8fd6b8c0c473 100644 --- a/tests/test-distribution/pom.xml +++ b/tests/test-distribution/pom.xml @@ -179,6 +179,11 @@ gcloud test + + org.testcontainers + mongodb + test + org.testcontainers junit-jupiter diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/MongodbSessionDistributionTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/MongodbSessionDistributionTests.java index 4d8f2e56b770..5ac3fdc8935f 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/MongodbSessionDistributionTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/MongodbSessionDistributionTests.java @@ -21,8 +21,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.MongoDBContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; +import org.testcontainers.utility.DockerImageName; /** * @@ -35,11 +37,12 @@ public class MongodbSessionDistributionTests extends AbstractSessionDistribution private static final int MONGO_PORT = 27017; - final String imageName = "mongo:" + System.getProperty("mongo.docker.version", "2.2.7"); - final GenericContainer mongoDBContainer = - new GenericContainer(imageName) - .withLogConsumer(new Slf4jLogConsumer(MONGO_LOG)) - .withExposedPorts(MONGO_PORT); + final String imageName = "mongo:" + System.getProperty("mongo.docker.version", "3.2.20"); + + final MongoDBContainer mongoDBContainer = + new MongoDBContainer(DockerImageName.parse(imageName)) + .withLogConsumer(new Slf4jLogConsumer(MONGO_LOG)); + private String host; private int port; diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index 8d138455629c..576e8c775225 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -11,8 +11,6 @@ ${project.groupId}.sessions.mongo localhost - - 3.2.20 diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java index f7a010236eb3..ae54a55a824d 100644 --- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoTestHelper.java @@ -53,7 +53,6 @@ public class MongoTestHelper private static final int MONGO_PORT = 27017; static MongoDBContainer mongo = - //new GenericContainer("mongo:" + System.getProperty("mongo.docker.version", "2.2.7")) new MongoDBContainer(DockerImageName.parse("mongo:" + System.getProperty("mongo.docker.version", "3.2.20"))) .withLogConsumer(new Slf4jLogConsumer(MONGO_LOG)); From ba6fec8150cb319ff66e972527662876b45de58e Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 22 Oct 2021 17:19:20 +1000 Subject: [PATCH 5/7] create only once Signed-off-by: Olivier Lamy --- .../HazelcastSessionDistributionTests.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java index 952a3366a1ac..76b07579aeed 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java @@ -31,13 +31,10 @@ import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.tests.distribution.JettyHomeTester; -import org.junit.jupiter.api.Assumptions; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testcontainers.DockerClientFactory; import org.testcontainers.containers.BindMode; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; @@ -54,24 +51,20 @@ public class HazelcastSessionDistributionTests extends AbstractSessionDistributi private static final Logger LOGGER = LoggerFactory.getLogger(HazelcastSessionDistributionTests.class); - private GenericContainer hazelcast; - - private Path hazelcastJettyPath; - - @BeforeEach - public void setupHazelcast() - { - hazelcast = new GenericContainer<>("hazelcast/hazelcast:" + System.getProperty("hazelcast.version", "4.2.2")) + private GenericContainer hazelcast = new GenericContainer<>("hazelcast/hazelcast:" + System.getProperty("hazelcast.version", "4.2.2")) .withExposedPorts(5701) .waitingFor(Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(120L))) .withLogConsumer(new Slf4jLogConsumer(HAZELCAST_LOG)); - } + + private Path hazelcastJettyPath; @Override public void startExternalSessionStorage() throws Exception { - hazelcast.start(); - + if (!hazelcast.isRunning()) + { + hazelcast.start(); + } String hazelcastHost = hazelcast.getContainerIpAddress(); int hazelcastPort = hazelcast.getMappedPort(5701); From b9ca21b62fbdc375bec2c6383de3a3982d9e47fe Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 22 Oct 2021 19:32:32 +1000 Subject: [PATCH 6/7] use a different wait strategy based on log rather than port as hazelcast try to do some broadcastind Signed-off-by: Olivier Lamy --- .../session/HazelcastSessionDistributionTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java index 76b07579aeed..3bc508fbf541 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/session/HazelcastSessionDistributionTests.java @@ -53,7 +53,8 @@ public class HazelcastSessionDistributionTests extends AbstractSessionDistributi private GenericContainer hazelcast = new GenericContainer<>("hazelcast/hazelcast:" + System.getProperty("hazelcast.version", "4.2.2")) .withExposedPorts(5701) - .waitingFor(Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(120L))) + .waitingFor(Wait.forLogMessage(".*is STARTED.*", 1)) + //.waitingFor(Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(120L))) .withLogConsumer(new Slf4jLogConsumer(HAZELCAST_LOG)); private Path hazelcastJettyPath; From 81675c43ea2322513975e37f8fd3a35d2927d313 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 22 Oct 2021 21:35:51 +1000 Subject: [PATCH 7/7] change wait for strategy Signed-off-by: Olivier Lamy --- .../server/session/remote/RemoteInfinispanTestSupport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java index 7638eb552aae..fffcd98a1170 100644 --- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java +++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanTestSupport.java @@ -36,6 +36,7 @@ import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; +import org.testcontainers.containers.wait.strategy.Wait; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -69,8 +70,7 @@ public class RemoteInfinispanTestSupport .withEnv("PASS", "foobar") .withEnv("MGMT_USER", "admin") .withEnv("MGMT_PASS", "admin") - .waitingFor(new LogMessageWaitStrategy() - .withRegEx(".*Infinispan Server.*started in.*\\s")) + .waitingFor(Wait.forLogMessage(".*Infinispan Server.*started in.*\\s", 1)) .withExposedPorts(4712, 4713, 8088, 8089, 8443, 9990, 9993, 11211, 11222, 11223, 11224) .withLogConsumer(new Slf4jLogConsumer(INFINISPAN_LOG)); infinispan.start();