Skip to content

Commit 8288d13

Browse files
committed
pr fixups; use just one wait strategy. missed one place for the image update
1 parent 38db2e2 commit 8288d13

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

embedded-mongodb/src/main/java/com/playtika/testcontainer/mongodb/EmbeddedMongodbBootstrapConfiguration.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.testcontainers.containers.GenericContainer;
2222
import org.testcontainers.containers.Network;
2323
import org.testcontainers.containers.ToxiproxyContainer;
24-
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
2524
import org.testcontainers.images.builder.Transferable;
2625
import org.testcontainers.shaded.org.apache.commons.lang3.StringUtils;
2726

@@ -72,13 +71,13 @@ public GenericContainer<?> mongodb(ConfigurableEnvironment environment,
7271
Optional<Network> network) throws IOException, InterruptedException {
7372

7473
GenericContainer<?> mongodb;
75-
if (properties.getReplicaSetName() == null) {
74+
if (StringUtils.isBlank(properties.getReplicaSetName())) {
7675
mongodb = new GenericContainer<>(ContainerUtils.getDockerImageName(properties))
7776
.withEnv("MONGO_INITDB_ROOT_USERNAME", properties.getUsername())
7877
.withEnv("MONGO_INITDB_ROOT_PASSWORD", properties.getPassword())
7978
.withEnv("MONGO_INITDB_DATABASE", properties.getDatabase())
8079
.withExposedPorts(properties.getPort())
81-
.waitingFor(new LogMessageWaitStrategy().withRegEx(".*mongod startup complete.*"))
80+
.waitingFor(new MongodbWaitStrategy(properties))
8281
.withNetworkAliases(MONGODB_NETWORK_ALIAS);
8382
} else {
8483
mongodb = new GenericContainer<>(ContainerUtils.getDockerImageName(properties))

embedded-mongodb/src/main/java/com/playtika/testcontainer/mongodb/MongodbProperties.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public class MongodbProperties extends CommonContainerProperties {
2525
private String username;
2626
private String password;
2727
private String database = "test";
28+
/**
29+
* If provided, mongodb will be started as a replica set with the given name. Default: null (standalone mode).
30+
*/
2831
private String replicaSetName;
2932

3033
public MongodbProperties() {

embedded-mongodb/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{
99
"name": "embedded.mongodb.dockerImage",
1010
"type": "java.lang.String",
11-
"defaultValue": "mongodb/mongodb-community-server:7.0.12-ubuntu2204"
11+
"defaultValue": "mongodb/mongodb-community-server:8.2.2-ubuntu2204"
1212
},
1313
{
1414
"name": "embedded.mongodb.host",
@@ -35,4 +35,4 @@
3535
"type": "java.lang.String"
3636
}
3737
]
38-
}
38+
}

0 commit comments

Comments
 (0)