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
{{ message }}
Repository navigation
Add a wait_for_healthcheck method to DockerCompose #241
It's possible to check if the healthcheck passed trought the cli. docker ps --format json will list all the services running and their corresponding healthchecks.
Proposed method signature: compose.wait_for_healthcheck(sec: int = 10)
High level description how it should work:
Iterate trough services check if healthcheck is healthy.
If not: wait and repeat until timeout.
testcontaners java and node has the option to wait for healthcheck. It would be nice if testcontainers-python would have the same funtionality
A very simple implementation for a DockerContainer can look like this:
withcontainer:
start_time=time.time()
underlying_container=container.get_wrapped_container()
whiletime.time() -start_time<10:
underlying_container.reload()
ifunderlying_container.health=='healthy':
print(f"Container is healthy!")
breaktime.sleep(.1)
else:
raiseTimeoutError(
f"Container status is not healthy after 10s - it's {underlying_container.health}!"
)
yieldcontainer
Activity
rhoban13 commentedon Jan 17, 2024
Ideally this should work for even the
DockerContaineras well.lukasz-matter commentedon Sep 19, 2024
A very simple implementation for a
DockerContainercan look like this:aligator commentedon Apr 2, 2025
.health didn't work for me somehow...
I got it working with using the attributes directly.
Could something like this wait_for_healthy be added to testcontainers-python?
chore: filter testcontainers deprecation warning and document bug
feat: RFC 3507 ICAP client with async, SSL/TLS, and pytest plugin (#20)