Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrientDB: Use log wait strategy for more reliable readiness detection #4471

Merged
merged 6 commits into from
Oct 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.containers.wait.strategy.WaitAllStrategy;
import org.testcontainers.containers.wait.strategy.WaitStrategy;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import org.testcontainers.utility.DockerImageName;

import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Optional;

import static java.net.HttpURLConnection.HTTP_OK;

/**
* @author robfrank
*/
Expand Down Expand Up @@ -68,14 +62,7 @@ public OrientDBContainer(final DockerImageName dockerImageName) {
serverPassword = DEFAULT_SERVER_PASSWORD;
databaseName = DEFAULT_DATABASE_NAME;

WaitStrategy waitForHttp = new HttpWaitStrategy()
.forPort(DEFAULT_HTTP_PORT)
.forStatusCodeMatching(response -> response == HTTP_OK);

waitStrategy = new WaitAllStrategy()
.withStrategy(Wait.forListeningPort())
.withStrategy(waitForHttp)
.withStartupTimeout(Duration.ofMinutes(2));
waitStrategy = new LogMessageWaitStrategy().withRegEx(".*Gremlin started correctly.*");

addExposedPorts(DEFAULT_BINARY_PORT, DEFAULT_HTTP_PORT);
}
Expand Down