@@ -34,9 +34,9 @@ elasticsearch:
3434Note that it is not necessary to define ports to be exposed in the YAML file; this would inhibit reuse/inclusion of the
3535file in other contexts.
3636
37- Instead, Testcontainers will spin up a small 'ambassador' container for every exposed service port , which will proxy
38- between the Compose-managed container and a port that's accessible to your tests. This is done using a separate, minimal
39- container that runs HAProxy in TCP proxying mode .
37+ Instead, Testcontainers will spin up a small 'ambassador' container, which will proxy
38+ between the Compose-managed containers and ports that are accessible to your tests. This is done using a separate, minimal
39+ container that runs socat as a TCP proxy .
4040
4141## Accessing a container from tests
4242
@@ -68,16 +68,15 @@ Waiting for exposed port to start listening:
6868@ClassRule
6969public static DockerComposeContainer environment =
7070 new DockerComposeContainer(new File("src/test/resources/compose-test.yml"))
71- .withStartupTimeout(Duration.ofSeconds(30))
72- .withExposedService("redis_1", REDIS_PORT, Wait.forListeningPort());
71+ .withExposedService("redis_1", REDIS_PORT,
72+ Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(30) ));
7373` ` `
7474
7575Wait for arbitrary status code on an HTTPS endpoint :
7676` ` ` java
7777@ClassRule
7878public static DockerComposeContainer environment =
7979 new DockerComposeContainer(new File("src/test/resources/compose-test.yml"))
80- .withStartupTimeout(Duration.ofSeconds(30))
8180 .withExposedService("elasticsearch_1", ELASTICSEARCH_PORT,
8281 Wait.forHttp("/all")
8382 .forStatusCode(301)
@@ -89,7 +88,6 @@ Separate wait strategies for each container:
8988@ClassRule
9089public static DockerComposeContainer environment =
9190 new DockerComposeContainer(new File("src/test/resources/compose-test.yml"))
92- .withStartupTimeout(Duration.ofSeconds(30))
9391 .withExposedService("redis_1", REDIS_PORT, Wait.forListeningPort())
9492 .withExposedService("elasticsearch_1", ELASTICSEARCH_PORT,
9593 Wait.forHttp("/all")
@@ -104,7 +102,6 @@ for example if you need to wait on a log message from a service, but don't need
104102@ClassRule
105103public static DockerComposeContainer environment =
106104 new DockerComposeContainer(new File("src/test/resources/compose-test.yml"))
107- .withStartupTimeout(Duration.ofSeconds(30))
108105 .withExposedService("redis_1", REDIS_PORT, Wait.forListeningPort())
109106 .waitingFor("db_1", Wait.forLogMessage("started", 1));
110107` ` `
0 commit comments