diff --git a/cosid-mongo/src/test/java/me/ahoo/cosid/mongo/MongoLauncher.java b/cosid-mongo/src/test/java/me/ahoo/cosid/mongo/MongoLauncher.java index f04debedfe..44498390c3 100644 --- a/cosid-mongo/src/test/java/me/ahoo/cosid/mongo/MongoLauncher.java +++ b/cosid-mongo/src/test/java/me/ahoo/cosid/mongo/MongoLauncher.java @@ -19,7 +19,8 @@ import org.testcontainers.utility.DockerImageName; public class MongoLauncher { - private static final String DEV_CONNECTION_STRING = "mongodb://root:root@localhost"; + private static final String CONNECTION_OPTIONS = "/?connectTimeoutMS=300000&maxIdleTimeMS=300000"; + private static final String DEV_CONNECTION_STRING = "mongodb://root:root@localhost" + CONNECTION_OPTIONS; private static final MongoDBContainer MONGO_CONTAINER = new MongoDBContainer(DockerImageName.parse("mongo:6.0.12")) .withNetworkAliases("mongo") .withReuse(true); @@ -29,6 +30,7 @@ public static String getConnectionString() { return DEV_CONNECTION_STRING; } MONGO_CONTAINER.start(); - return MONGO_CONTAINER.getConnectionString(); + return MONGO_CONTAINER.getConnectionString() + CONNECTION_OPTIONS; + } } diff --git a/cosid-spring-boot-starter/src/test/java/me/ahoo/cosid/spring/boot/starter/mongo/MongoLauncher.java b/cosid-spring-boot-starter/src/test/java/me/ahoo/cosid/spring/boot/starter/mongo/MongoLauncher.java index 988640499e..77b87670fa 100644 --- a/cosid-spring-boot-starter/src/test/java/me/ahoo/cosid/spring/boot/starter/mongo/MongoLauncher.java +++ b/cosid-spring-boot-starter/src/test/java/me/ahoo/cosid/spring/boot/starter/mongo/MongoLauncher.java @@ -19,7 +19,8 @@ import org.testcontainers.utility.DockerImageName; public class MongoLauncher { - private static final String DEV_CONNECTION_STRING = "mongodb://root:root@localhost"; + private static final String CONNECTION_OPTIONS = "/?connectTimeoutMS=300000&maxIdleTimeMS=300000"; + private static final String DEV_CONNECTION_STRING = "mongodb://root:root@localhost" + CONNECTION_OPTIONS; private static final MongoDBContainer MONGO_CONTAINER = new MongoDBContainer(DockerImageName.parse("mongo:6.0.12")) .withNetworkAliases("mongo") .withReuse(true); @@ -29,6 +30,7 @@ public static String getConnectionString() { return DEV_CONNECTION_STRING; } MONGO_CONTAINER.start(); - return MONGO_CONTAINER.getConnectionString(); + return MONGO_CONTAINER.getConnectionString() + CONNECTION_OPTIONS; + } }