testcontainers / testcontainers/testcontainers-python
Bug: `testcontainers.core.waiting_utils.wait_for_logs` keeps waiting despite the container has exited.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 386
- Avg merge
- 4h 40m
- Merged PRs (30d)
- 1
Description
Describe the bug
The testcontainers.core.waiting_utils.wait_for_logs keeps waiting despite the container has exited. This can be confusing if there is a long wait time.
To Reproduce
from testcontainers.core import container, waiting_utils
if __name__ == "__main__":
waiting_utils.wait_for_logs(
container.DockerContainer("flyway/flyway").start(),
r"Successfully applied \d+ migrations to schema",
timeout=large_n, #
)
# >> Raised Exception has occurred: TimeoutError Container did not emit logs satisfying predicate in `large_n` seconds
Runtime environment
Python: 3.11.9
testcontainers 4.7.2
Implementation: CPython
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in testcontainers.core.waiting_utils at wait_for_logs and inspect how the DockerContainer state is checked while waiting for matching logs. Reproduce the example with flyway/flyway and determine the expected behavior when the container exits before the predicate matches. Done means the wait no longer continues until timeout after the container has exited.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- devops, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100