Skip to content

Commit 33218e7

Browse files
authored
OrientDB: Use log wait strategy for more reliable readiness detection (#4471)
1 parent be26e4c commit 33218e7

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

modules/orientdb/src/main/java/org/testcontainers/containers/OrientDBContainer.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@
99
import org.apache.commons.io.IOUtils;
1010
import org.slf4j.Logger;
1111
import org.slf4j.LoggerFactory;
12-
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
13-
import org.testcontainers.containers.wait.strategy.Wait;
14-
import org.testcontainers.containers.wait.strategy.WaitAllStrategy;
15-
import org.testcontainers.containers.wait.strategy.WaitStrategy;
12+
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
1613
import org.testcontainers.utility.DockerImageName;
1714

1815
import java.io.IOException;
1916
import java.net.URL;
2017
import java.nio.charset.StandardCharsets;
21-
import java.time.Duration;
2218
import java.util.Optional;
2319

24-
import static java.net.HttpURLConnection.HTTP_OK;
25-
2620
/**
2721
* @author robfrank
2822
*/
@@ -68,14 +62,7 @@ public OrientDBContainer(final DockerImageName dockerImageName) {
6862
serverPassword = DEFAULT_SERVER_PASSWORD;
6963
databaseName = DEFAULT_DATABASE_NAME;
7064

71-
WaitStrategy waitForHttp = new HttpWaitStrategy()
72-
.forPort(DEFAULT_HTTP_PORT)
73-
.forStatusCodeMatching(response -> response == HTTP_OK);
74-
75-
waitStrategy = new WaitAllStrategy()
76-
.withStrategy(Wait.forListeningPort())
77-
.withStrategy(waitForHttp)
78-
.withStartupTimeout(Duration.ofMinutes(2));
65+
waitStrategy = new LogMessageWaitStrategy().withRegEx(".*Gremlin started correctly.*");
7966

8067
addExposedPorts(DEFAULT_BINARY_PORT, DEFAULT_HTTP_PORT);
8168
}

0 commit comments

Comments
 (0)