-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Currently, some WaitStrategy implementations (for example HostPortWaitStrategy) provide very limited information when container startup fails.
For developers running integration tests, this makes debugging difficult because logs don’t indicate which port or condition failed.
Proposal:
1.Add a more descriptive toString() implementation to WaitStrategy classes.
2.Include key configuration details (e.g. target port, retries, timeout) in the string.
3.Ensure these details appear in logs when wait strategy fails.
Benefits:
1.Improves developer experience when using Testcontainers.
2.Provides clear context in logs without changing core functionality.
3.Small, non-breaking change that helps in debugging test failures.
Scope:
1.Modify HostPortWaitStrategy (and optionally other WaitStrategy classes where toString() is missing or vague).
2.Add a unit test that verifies the toString() output contains expected fields.
Example Log Improvement
Current :-
org.testcontainers.containers.wait.strategy.WaitUntilReady: Wait failed
Proposed :-
org.testcontainers.containers.wait.strategy.HostPortWaitStrategy{port=5432, timeout=60s, retries=10} - Wait failed