-
Notifications
You must be signed in to change notification settings - Fork 142
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
Add WaitFor::Healthy #321
Comments
Looking at the Java Testcontainers, there is a facility for performing HTTP checks, which provides a generalized strategy for something like WaitFor::HttpStatus: public CockroachContainer(final DockerImageName dockerImageName) {
super(dockerImageName);
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);
withExposedPorts(REST_API_PORT, DB_PORT);
waitingFor(
new HttpWaitStrategy()
.forPath("/health")
.forPort(REST_API_PORT)
.forStatusCode(200)
.withStartupTimeout(Duration.ofMinutes(1))
);
withCommand("start-single-node --insecure");
} |
I'd merge a PR that adds |
Having |
All of Instead, we need to identify the various strategies for determining health (log message, port open, http status, etc) and add those as variants to A particular image can then compose those strategies together for an overall "wait until healthy" behaviour :) I haven't looked at the rabbitmq thing in detail but executing a command and checking its return value might be another viable |
@thomaseizinger the Java testcontainers has the DockerHealthcheckWaitStrategy (docs) though :) |
Probably I was wrong suggesting the name |
I didn't know docker had this feature, interesting! Is there a CLI flag that we can use to wait for the health checks before the startup is considered complete? |
After reading these docs a bit, |
Glad we're on the same page now :)
I'm using the following command to detect the container's status:
It returns either |
Thanks for that. It is unfortunate that the CLI doesn't allow you to pass Meaning we need to implement a busy waiting loop ourselves. |
Well, the first step is done, now we need to wait for a while :) softprops/shiplift#323 |
Or, perhaps, it could be better to switch to another crate :\ softprops/shiplift#321 |
Currently implemented waiting conditions can't guarantee that the application in the container is ready and is working correctly.
Some of the containers have healthchecks (e.g. plexinc/pms-docker) and for those it could be useful to rely on the healthcheck results instead of processing stdout/stderr.
The text was updated successfully, but these errors were encountered: