Last active
May 18, 2020 16:51
-
-
Save max-weis/8cfa32cc98ef1ed412a0e6b8df1339ed to your computer and use it in GitHub Desktop.
4 ways to wait for a container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Status Code | |
GenericContainer container = new GenericContainer("your/image:1.0.0") | |
.waitingFor(Wait.forHttp("/")); | |
// Docker Healthcheck | |
GenericContainer container = new GenericContainer("your/image:1.0.0") | |
.waitingFor(Wait.forHealthcheck()); | |
// Log | |
GenericContainer container = new GenericContainer("your/image:1.0.0") | |
.waitingFor(new WaitAllStrategy() | |
.withStrategy(Wait.forLogMessage(".*Started web server*.", 1)) | |
.withStartupTimeout(Duration.ofMinutes(1))); | |
// Health Probe | |
GenericContainer container = new GenericContainer("your/image:1.0.0") | |
.waitingFor(new WaitAllStrategy() | |
.withStrategy(Wait.forHttp("/health/live")) | |
.withStartupTimeout(Duration.ofMinutes(1))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment