diff --git a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/DefaultAndNamedMongoClientConfigTest.java b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/DefaultAndNamedMongoClientConfigTest.java index 9c8d367e1bc4a..61f1c87a8f5b6 100644 --- a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/DefaultAndNamedMongoClientConfigTest.java +++ b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/DefaultAndNamedMongoClientConfigTest.java @@ -11,6 +11,8 @@ import org.eclipse.microprofile.health.HealthCheckResponse; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.extension.RegisterExtension; import com.mongodb.client.MongoClient; @@ -21,6 +23,7 @@ import io.quarkus.mongodb.health.MongoHealthCheck; import io.quarkus.test.QuarkusUnitTest; +@DisabledOnOs(value = OS.WINDOWS, disabledReason = "Flapdoodle doesn't work very well on Windows with replicas") public class DefaultAndNamedMongoClientConfigTest extends MongoWithReplicasTestBase { @RegisterExtension diff --git a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/DefaultMongoClientConfigTest.java b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/DefaultMongoClientConfigTest.java index 45f9e74bb0a6b..bc9b08b54e5c8 100644 --- a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/DefaultMongoClientConfigTest.java +++ b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/DefaultMongoClientConfigTest.java @@ -11,6 +11,8 @@ import org.eclipse.microprofile.health.HealthCheckResponse; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.extension.RegisterExtension; import com.mongodb.client.MongoClient; @@ -19,6 +21,7 @@ import io.quarkus.mongodb.reactive.ReactiveMongoClient; import io.quarkus.test.QuarkusUnitTest; +@DisabledOnOs(value = OS.WINDOWS, disabledReason = "Flapdoodle doesn't work very well on Windows with replicas") public class DefaultMongoClientConfigTest extends MongoWithReplicasTestBase { @RegisterExtension diff --git a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoClientConfigTest.java b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoClientConfigTest.java index 3708be970d06e..97161fe578bfb 100644 --- a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoClientConfigTest.java +++ b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoClientConfigTest.java @@ -8,6 +8,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.extension.RegisterExtension; import com.mongodb.ReadConcern; @@ -21,6 +23,7 @@ import io.quarkus.mongodb.reactive.ReactiveMongoClient; import io.quarkus.test.QuarkusUnitTest; +@DisabledOnOs(value = OS.WINDOWS, disabledReason = "Flapdoodle doesn't work very well on Windows with replicas") public class MongoClientConfigTest extends MongoWithReplicasTestBase { @RegisterExtension diff --git a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoTestBase.java b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoTestBase.java index 11ec3e6ed53d1..c7359fa000824 100644 --- a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoTestBase.java +++ b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoTestBase.java @@ -11,6 +11,7 @@ import de.flapdoodle.embed.mongo.distribution.Version; import de.flapdoodle.embed.mongo.transitions.Mongod; import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess; +import de.flapdoodle.embed.process.types.ProcessConfig; import de.flapdoodle.reverse.TransitionWalker; import de.flapdoodle.reverse.transitions.Start; @@ -42,7 +43,7 @@ public static void startMongoDatabase() throws IOException { String uri = getConfiguredConnectionString(); // This switch allow testing against a running mongo database. if (uri == null) { - Version.Main version = Version.Main.V4_4; + Version.Main version = Version.Main.V7_0; int port = 27018; LOGGER.infof("Starting Mongo %s on port %s", version, port); @@ -53,6 +54,9 @@ public static void startMongoDatabase() throws IOException { .build())) .withMongodArguments(Start.to(MongodArguments.class) .initializedWith(MongodArguments.defaults().withUseNoJournal(false))) + .withProcessConfig( + Start.to(ProcessConfig.class) + .initializedWith(ProcessConfig.defaults().withStopTimeoutInMillis(15_000))) .start(version); } else { diff --git a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoWithReplicasTestBase.java b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoWithReplicasTestBase.java index 56c7417a7ce77..d2c39cc1e6e12 100644 --- a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoWithReplicasTestBase.java +++ b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoWithReplicasTestBase.java @@ -1,7 +1,6 @@ package io.quarkus.mongodb; import static io.quarkus.mongodb.MongoTestBase.getConfiguredConnectionString; -import static org.awaitility.Awaitility.await; import static org.awaitility.Durations.ONE_MINUTE; import static org.awaitility.Durations.ONE_SECOND; @@ -32,6 +31,7 @@ import de.flapdoodle.embed.mongo.transitions.Mongod; import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess; import de.flapdoodle.embed.process.io.ProcessOutput; +import de.flapdoodle.embed.process.types.ProcessConfig; import de.flapdoodle.reverse.TransitionWalker; import de.flapdoodle.reverse.transitions.Start; @@ -47,7 +47,7 @@ public static void startMongoDatabase() { // This switch allow testing against a running mongo database. if (uri == null) { - startedServers = startReplicaSet(Version.Main.V4_4, 27018, "test001"); + startedServers = startReplicaSet(Version.Main.V7_0, 27018, "test001"); } else { LOGGER.infof("Using existing Mongo %s", uri); } @@ -93,7 +93,10 @@ private static Mongod mongodWithPort(int port, String replicaSet) { .withProcessOutput(Start.to(ProcessOutput.class).initializedWith(ProcessOutput.silent())) .withMongodArguments(Start.to(MongodArguments.class).initializedWith( MongodArguments.defaults().withArgs(Map.of("--replSet", replicaSet)).withSyncDelay(10) - .withUseSmallFiles(true).withUseNoJournal(false))); + .withUseSmallFiles(true).withUseNoJournal(false))) + .withProcessConfig( + Start.to(ProcessConfig.class) + .initializedWith(ProcessConfig.defaults().withStopTimeoutInMillis(15_000))); } @AfterAll diff --git a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/NamedMongoClientConfigTest.java b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/NamedMongoClientConfigTest.java index 6dae624333538..39cb46564542d 100644 --- a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/NamedMongoClientConfigTest.java +++ b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/NamedMongoClientConfigTest.java @@ -13,6 +13,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.extension.RegisterExtension; import com.mongodb.client.MongoClient; @@ -23,6 +25,7 @@ import io.quarkus.mongodb.health.MongoHealthCheck; import io.quarkus.test.QuarkusUnitTest; +@DisabledOnOs(value = OS.WINDOWS, disabledReason = "Flapdoodle doesn't work very well on Windows with replicas") public class NamedMongoClientConfigTest extends MongoWithReplicasTestBase { @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest() diff --git a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/NamedReactiveMongoClientConfigTest.java b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/NamedReactiveMongoClientConfigTest.java index a5b2909d53d1d..97129aecc5c13 100644 --- a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/NamedReactiveMongoClientConfigTest.java +++ b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/NamedReactiveMongoClientConfigTest.java @@ -14,6 +14,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.extension.RegisterExtension; import com.mongodb.reactivestreams.client.MongoClient; @@ -28,6 +30,7 @@ import io.quarkus.mongodb.reactive.ReactiveMongoClient; import io.quarkus.test.QuarkusUnitTest; +@DisabledOnOs(value = OS.WINDOWS, disabledReason = "Flapdoodle doesn't work very well on Windows with replicas") public class NamedReactiveMongoClientConfigTest extends MongoWithReplicasTestBase { @RegisterExtension diff --git a/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/ConnectionToReplicaSetTest.java b/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/ConnectionToReplicaSetTest.java index e3970981d685a..fc5320a87048a 100644 --- a/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/ConnectionToReplicaSetTest.java +++ b/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/ConnectionToReplicaSetTest.java @@ -10,6 +10,8 @@ import org.bson.Document; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import com.mongodb.client.model.changestream.FullDocument; import com.mongodb.reactivestreams.client.MongoClients; @@ -17,6 +19,7 @@ import io.quarkus.mongodb.ChangeStreamOptions; import io.quarkus.mongodb.impl.ReactiveMongoClientImpl; +@DisabledOnOs(value = OS.WINDOWS, disabledReason = "Flapdoodle doesn't work very well on Windows with replicas") class ConnectionToReplicaSetTest extends MongoWithReplicasTestBase { private ReactiveMongoClient client; diff --git a/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/ListDatabaseTest.java b/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/ListDatabaseTest.java index a3c8599cc6df9..2131c874d679f 100644 --- a/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/ListDatabaseTest.java +++ b/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/ListDatabaseTest.java @@ -8,6 +8,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import com.mongodb.ClientSessionOptions; import com.mongodb.reactivestreams.client.ClientSession; @@ -15,6 +17,7 @@ import io.quarkus.mongodb.impl.ReactiveMongoClientImpl; +@DisabledOnOs(value = OS.WINDOWS, disabledReason = "Flapdoodle doesn't work very well on Windows with replicas") class ListDatabaseTest extends MongoWithReplicasTestBase { private ReactiveMongoClient client; diff --git a/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/MongoTestBase.java b/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/MongoTestBase.java index e47ac6b585c9b..a153208a266e5 100644 --- a/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/MongoTestBase.java +++ b/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/MongoTestBase.java @@ -21,6 +21,7 @@ import de.flapdoodle.embed.mongo.distribution.Version; import de.flapdoodle.embed.mongo.transitions.Mongod; import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess; +import de.flapdoodle.embed.process.types.ProcessConfig; import de.flapdoodle.reverse.TransitionWalker; import de.flapdoodle.reverse.transitions.Start; import io.smallrye.mutiny.Uni; @@ -55,7 +56,7 @@ public static void startMongoDatabase() throws IOException { String uri = getConfiguredConnectionString(); // This switch allow testing against a running mongo database. if (uri == null) { - Version.Main version = Version.Main.V4_4; + Version.Main version = Version.Main.V7_0; int port = 27018; LOGGER.infof("Starting Mongo %s on port %s", version, port); @@ -66,6 +67,9 @@ public static void startMongoDatabase() throws IOException { .build())) .withMongodArguments(Start.to(MongodArguments.class) .initializedWith(MongodArguments.defaults().withUseNoJournal(false))) + .withProcessConfig( + Start.to(ProcessConfig.class) + .initializedWith(ProcessConfig.defaults().withStopTimeoutInMillis(15_000))) .start(version); } else { diff --git a/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/MongoWithReplicasTestBase.java b/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/MongoWithReplicasTestBase.java index 5aae65b71a4a7..a6829f9a95af7 100644 --- a/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/MongoWithReplicasTestBase.java +++ b/extensions/mongodb-client/runtime/src/test/java/io/quarkus/mongodb/reactive/MongoWithReplicasTestBase.java @@ -31,6 +31,7 @@ import de.flapdoodle.embed.mongo.transitions.Mongod; import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess; import de.flapdoodle.embed.process.io.ProcessOutput; +import de.flapdoodle.embed.process.types.ProcessConfig; import de.flapdoodle.reverse.TransitionWalker; import de.flapdoodle.reverse.transitions.Start; @@ -46,7 +47,7 @@ public static void startMongoDatabase() { // This switch allow testing against a running mongo database. if (uri == null) { - startedServers = startReplicaSet(Version.Main.V4_4, 27018, "test001"); + startedServers = startReplicaSet(Version.Main.V7_0, 27018, "test001"); } else { LOGGER.infof("Using existing Mongo %s", uri); } @@ -92,7 +93,10 @@ private static Mongod mongodWithPort(int port, String replicaSet) { .withProcessOutput(Start.to(ProcessOutput.class).initializedWith(ProcessOutput.silent())) .withMongodArguments(Start.to(MongodArguments.class).initializedWith( MongodArguments.defaults().withArgs(Map.of("--replSet", replicaSet)).withSyncDelay(10) - .withUseSmallFiles(true).withUseNoJournal(false))); + .withUseSmallFiles(true).withUseNoJournal(false))) + .withProcessConfig( + Start.to(ProcessConfig.class) + .initializedWith(ProcessConfig.defaults().withStopTimeoutInMillis(15_000))); } @AfterAll diff --git a/test-framework/mongodb/src/main/java/io/quarkus/test/mongodb/MongoTestResource.java b/test-framework/mongodb/src/main/java/io/quarkus/test/mongodb/MongoTestResource.java index a8ca2e2ee3186..2481e8b1822f2 100644 --- a/test-framework/mongodb/src/main/java/io/quarkus/test/mongodb/MongoTestResource.java +++ b/test-framework/mongodb/src/main/java/io/quarkus/test/mongodb/MongoTestResource.java @@ -13,6 +13,7 @@ import de.flapdoodle.embed.mongo.distribution.Versions; import de.flapdoodle.embed.mongo.transitions.Mongod; import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess; +import de.flapdoodle.embed.process.types.ProcessConfig; import de.flapdoodle.reverse.TransitionWalker; import de.flapdoodle.reverse.transitions.Start; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; @@ -39,7 +40,7 @@ public static IFeatureAwareVersion version(Map initArgs) { return versionArg. map(Version.Main::valueOf) .orElseGet(() -> versionArg.map( versionStr -> Versions.withFeatures(de.flapdoodle.embed.process.distribution.Version.of(versionStr))) - .orElse(Version.Main.V4_4)); + .orElse(Version.Main.V7_0)); } public static void forceExtendedSocketOptionsClassInit() { @@ -68,6 +69,8 @@ public Map start() { .initializedWith(Net.builder().from(Net.defaults()).port(port).build())) .withMongodArguments(Start.to(MongodArguments.class) .initializedWith(MongodArguments.defaults().withUseNoJournal(false))) + .withProcessConfig( + Start.to(ProcessConfig.class).initializedWith(ProcessConfig.defaults().withStopTimeoutInMillis(15_000))) .start(version); return Collections.singletonMap("quarkus.mongodb.hosts", String.format("127.0.0.1:%d", port));