fix: Throw an exception if the container has exited while checking for readiness#1451
fix: Throw an exception if the container has exited while checking for readiness#14510xced wants to merge 3 commits intotestcontainers:developfrom
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
88b2982 to
bfe1617
Compare
|
Many tests are failing, this is more complicated than I first thought. 😟 |
I haven't looked closely at the implementation yet, but my initial idea was to create a base class for the wait strategy that checks whether the container has exited. |
HofmeisterAn
left a comment
There was a problem hiding this comment.
What do you think about adding an IWaitStrategy option to disable the container exited check (enabled by default)?
This would allow disabling it for strategies that only need to run the container and entrypoint, similar to Java's one shot startup strategy.
We could also extend IWaitUntil or make it abstract with a default configuration, so developers can opt out of the check in specific implementations.
4900ecd to
8fa5f1b
Compare
What does this PR do?
This pull request ensures that if a container has exited, readiness check are aborted with the newly introduced
ContainerException. The exception message includes both stdout and stderr of the container to help diagnosing the issue.Why is it important?
As described in #1445, this change significantly improves the developer experience. Developers get immediate feedback when something goes wrong.
Related issues
Fixes #1445
How to test this PR
A simple way to test this PR is to run the Oracle21 tests on an Apple Silicon Mac. You'll get this error.
Another way is to update
JanusGraphContainerTestwith a bad configuration:This is a bit slow because the container tries to access the storage backend several times before giving up. Eventually the
ContainerExceptionis raised.