testcontainers / testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
https://testcontainers-python.readthedocs.io/en/latest/
Apache License 2.0
1.51k stars 281 forks source link

Add a wait_for_healthcheck method to DockerCompose #241

Open csikb opened 2 years ago

csikb commented 2 years ago

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

rhoban13 commented 7 months ago

Ideally this should work for even the DockerContainer as well.