From 48b89f939410ed0287da6807158cd79abf51eaff Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 17 Nov 2020 16:20:16 +1000 Subject: [PATCH] use @Testcontainers to disable test if docker not available (#5678) Signed-off-by: olivier lamy --- tests/test-sessions/test-gcloud-sessions/pom.xml | 5 +++++ .../jetty/gcloud/session/ClusteredOrphanedSessionTest.java | 2 ++ .../jetty/gcloud/session/ClusteredSessionScavengingTest.java | 2 ++ .../jetty/gcloud/session/GCloudSessionDataStoreTest.java | 2 ++ .../jetty/gcloud/session/InvalidationSessionTest.java | 2 ++ tests/test-sessions/test-infinispan-sessions/pom.xml | 5 +++++ .../remote/RemoteClusteredInvalidationSessionTest.java | 2 ++ .../session/remote/RemoteClusteredSessionScavengingTest.java | 2 ++ .../session/remote/RemoteInfinispanSessionDataStoreTest.java | 2 ++ .../memcached/sessions/CachingSessionDataStoreTest.java | 2 ++ .../org/eclipse/jetty/nosql/mongodb/AttributeNameTest.java | 2 ++ .../jetty/nosql/mongodb/ClusteredInvalidateSessionTest.java | 2 ++ .../jetty/nosql/mongodb/ClusteredOrphanedSessionTest.java | 2 ++ .../jetty/nosql/mongodb/ClusteredSessionScavengingTest.java | 2 ++ .../jetty/nosql/mongodb/MongoSessionDataStoreTest.java | 2 ++ 15 files changed, 36 insertions(+) diff --git a/tests/test-sessions/test-gcloud-sessions/pom.xml b/tests/test-sessions/test-gcloud-sessions/pom.xml index 82bb0ed67ea..1cd62d86369 100644 --- a/tests/test-sessions/test-gcloud-sessions/pom.xml +++ b/tests/test-sessions/test-gcloud-sessions/pom.xml @@ -66,6 +66,11 @@ testcontainers test + + org.testcontainers + junit-jupiter + test + org.testcontainers gcloud diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClusteredOrphanedSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClusteredOrphanedSessionTest.java index 1aa4c414ebc..bc68d5f2e32 100644 --- a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClusteredOrphanedSessionTest.java +++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClusteredOrphanedSessionTest.java @@ -23,10 +23,12 @@ import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.testcontainers.junit.jupiter.Testcontainers; /** * ClusteredOrphanedSessionTest */ +@Testcontainers(disabledWithoutDocker = true) public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessionTest { diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClusteredSessionScavengingTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClusteredSessionScavengingTest.java index b248fa40684..a2da77faa2a 100644 --- a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClusteredSessionScavengingTest.java +++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/ClusteredSessionScavengingTest.java @@ -22,10 +22,12 @@ import org.eclipse.jetty.server.session.AbstractClusteredSessionScavengingTest; import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.junit.jupiter.Testcontainers; /** * ClusteredSessionScavengingTest */ +@Testcontainers(disabledWithoutDocker = true) public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScavengingTest { diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStoreTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStoreTest.java index 52f8750567a..189a19d801b 100644 --- a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStoreTest.java +++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStoreTest.java @@ -24,10 +24,12 @@ import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.junit.jupiter.Testcontainers; /** * GCloudSessionDataStoreTest */ +@Testcontainers(disabledWithoutDocker = true) public class GCloudSessionDataStoreTest extends AbstractSessionDataStoreTest { diff --git a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/InvalidationSessionTest.java b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/InvalidationSessionTest.java index 03b0cdf266c..4a7c0f0e202 100644 --- a/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/InvalidationSessionTest.java +++ b/tests/test-sessions/test-gcloud-sessions/src/test/java/org/eclipse/jetty/gcloud/session/InvalidationSessionTest.java @@ -22,10 +22,12 @@ import org.eclipse.jetty.server.session.AbstractClusteredInvalidationSessionTest import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.junit.jupiter.Testcontainers; /** * InvalidationSessionTest */ +@Testcontainers(disabledWithoutDocker = true) public class InvalidationSessionTest extends AbstractClusteredInvalidationSessionTest { diff --git a/tests/test-sessions/test-infinispan-sessions/pom.xml b/tests/test-sessions/test-infinispan-sessions/pom.xml index 1faf12950d4..7f2c0d97619 100644 --- a/tests/test-sessions/test-infinispan-sessions/pom.xml +++ b/tests/test-sessions/test-infinispan-sessions/pom.xml @@ -145,6 +145,11 @@ testcontainers test + + org.testcontainers + junit-jupiter + test + diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteClusteredInvalidationSessionTest.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteClusteredInvalidationSessionTest.java index 0b86b4422f9..439991c7f67 100644 --- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteClusteredInvalidationSessionTest.java +++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteClusteredInvalidationSessionTest.java @@ -23,10 +23,12 @@ import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.junit.jupiter.Testcontainers; /** * InvalidationSessionTest */ +@Testcontainers(disabledWithoutDocker = true) public class RemoteClusteredInvalidationSessionTest extends AbstractClusteredInvalidationSessionTest { diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteClusteredSessionScavengingTest.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteClusteredSessionScavengingTest.java index 312129de966..f68237da62e 100644 --- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteClusteredSessionScavengingTest.java +++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteClusteredSessionScavengingTest.java @@ -23,10 +23,12 @@ import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.junit.jupiter.Testcontainers; /** * ClusteredSessionScavengingTest */ +@Testcontainers(disabledWithoutDocker = true) public class RemoteClusteredSessionScavengingTest extends AbstractClusteredSessionScavengingTest { diff --git a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanSessionDataStoreTest.java b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanSessionDataStoreTest.java index 718a38e06e3..de227bd1191 100644 --- a/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanSessionDataStoreTest.java +++ b/tests/test-sessions/test-infinispan-sessions/src/test/java/org/eclipse/jetty/server/session/remote/RemoteInfinispanSessionDataStoreTest.java @@ -36,6 +36,7 @@ import org.infinispan.query.dsl.QueryFactory; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.testcontainers.junit.jupiter.Testcontainers; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -43,6 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; /** * RemoteInfinispanSessionDataStoreTest */ +@Testcontainers(disabledWithoutDocker = true) public class RemoteInfinispanSessionDataStoreTest extends AbstractSessionDataStoreTest { diff --git a/tests/test-sessions/test-memcached-sessions/src/test/java/org/eclipse/jetty/memcached/sessions/CachingSessionDataStoreTest.java b/tests/test-sessions/test-memcached-sessions/src/test/java/org/eclipse/jetty/memcached/sessions/CachingSessionDataStoreTest.java index 30a652609b5..8124a05c48f 100644 --- a/tests/test-sessions/test-memcached-sessions/src/test/java/org/eclipse/jetty/memcached/sessions/CachingSessionDataStoreTest.java +++ b/tests/test-sessions/test-memcached-sessions/src/test/java/org/eclipse/jetty/memcached/sessions/CachingSessionDataStoreTest.java @@ -38,6 +38,7 @@ import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.eclipse.jetty.server.session.TestServer; import org.eclipse.jetty.servlet.ServletContextHandler; import org.junit.jupiter.api.Test; +import org.testcontainers.junit.jupiter.Testcontainers; import static org.junit.Assert.assertNull; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -47,6 +48,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * CachingSessionDataStoreTest */ +@Testcontainers(disabledWithoutDocker = true) public class CachingSessionDataStoreTest { diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/AttributeNameTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/AttributeNameTest.java index e448857fe65..372f642382a 100644 --- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/AttributeNameTest.java +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/AttributeNameTest.java @@ -37,6 +37,7 @@ import org.eclipse.jetty.server.session.TestServer; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.testcontainers.junit.jupiter.Testcontainers; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -49,6 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * properly escaped and not accidentally removed. * See bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=444595 */ +@Testcontainers(disabledWithoutDocker = true) public class AttributeNameTest { diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredInvalidateSessionTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredInvalidateSessionTest.java index ddfb13e20b4..738db6509cc 100644 --- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredInvalidateSessionTest.java +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredInvalidateSessionTest.java @@ -22,7 +22,9 @@ import org.eclipse.jetty.server.session.AbstractClusteredInvalidationSessionTest import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.junit.jupiter.Testcontainers; +@Testcontainers(disabledWithoutDocker = true) public class ClusteredInvalidateSessionTest extends AbstractClusteredInvalidationSessionTest { diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredOrphanedSessionTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredOrphanedSessionTest.java index 3b35422e39b..455d506bac1 100644 --- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredOrphanedSessionTest.java +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredOrphanedSessionTest.java @@ -23,10 +23,12 @@ import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.testcontainers.junit.jupiter.Testcontainers; /** * ClusteredOrphanedSessionTest */ +@Testcontainers(disabledWithoutDocker = true) public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessionTest { diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredSessionScavengingTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredSessionScavengingTest.java index d7e83d5c5c9..37b5c341e06 100644 --- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredSessionScavengingTest.java +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/ClusteredSessionScavengingTest.java @@ -22,7 +22,9 @@ import org.eclipse.jetty.server.session.AbstractClusteredSessionScavengingTest; import org.eclipse.jetty.server.session.SessionDataStoreFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.junit.jupiter.Testcontainers; +@Testcontainers(disabledWithoutDocker = true) public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScavengingTest { diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoSessionDataStoreTest.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoSessionDataStoreTest.java index db2366b2f6a..65e5583aabc 100644 --- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoSessionDataStoreTest.java +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/MongoSessionDataStoreTest.java @@ -33,6 +33,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.testcontainers.junit.jupiter.Testcontainers; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -40,6 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; /** * MongoSessionDataStoreTest */ +@Testcontainers(disabledWithoutDocker = true) public class MongoSessionDataStoreTest extends AbstractSessionDataStoreTest {