You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default Testcontainers uses the "listening ports" wait strategy for all containers. If you'd like to override
49
-
the default wait strategy for all services, you can do so:
48
+
By default, Testcontainers waits for a service health check when one is defined in the Compose service or image. If no health check is defined, or the service disables health checks, it waits for listening ports.
49
+
50
+
If you'd like to override the default wait strategy for all services, you can do so:
Copy file name to clipboardExpand all lines: docs/features/wait-strategies.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,15 @@ const container = await new GenericContainer("alpine")
10
10
.start();
11
11
```
12
12
13
+
## Default wait strategy
14
+
15
+
By default, Testcontainers waits for a container health check when one is defined by the image or configured with `withHealthCheck`. If no health check is defined, or the image disables health checks with `HEALTHCHECK NONE`, it waits up to 60 seconds for mapped network ports to be bound.
16
+
17
+
You can override this selection with `withWaitStrategy`.
18
+
13
19
## Listening ports
14
20
15
-
The default wait strategy used by Testcontainers. It will wait up to 60 seconds for the container's mapped network ports to be bound.
21
+
Wait up to 60 seconds for the container's mapped network ports to be bound.
@@ -65,7 +71,7 @@ const container = await new GenericContainer("alpine")
65
71
66
72
## Health check
67
73
68
-
Wait until the container's health check is successful:
74
+
Explicitly wait until the container's health check is successful. This is optional when the image already defines a health check because Testcontainers uses that as the default wait strategy:
@@ -75,10 +81,10 @@ const container = await new GenericContainer("alpine")
75
81
.start();
76
82
```
77
83
78
-
Define your own health check. Note that time units are in seconds:
84
+
Define your own health check. Testcontainers uses this as the default wait strategy unless you explicitly set another wait strategy. Note that time units are in milliseconds:
0 commit comments