-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure we don't hide exceptions from waitUntilContainerStarted #6167
Merged
eddumelendez
merged 1 commit into
testcontainers:main
from
deejgregor:fix-exception-hiding-wait-until-container-started
Dec 14, 2022
Merged
Make sure we don't hide exceptions from waitUntilContainerStarted #6167
eddumelendez
merged 1 commit into
testcontainers:main
from
deejgregor:fix-exception-hiding-wait-until-container-started
Dec 14, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e9adc4f
to
fd82b30
Compare
deejgregor
added a commit
to OpenNMS/opennms
that referenced
this pull request
Nov 13, 2022
See testcontainers/testcontainers-java#6167 This change should be temporary until the above fix is released and we update. Created waitUntilReadyWrapped to make it less messy to make this change now and revert it later.
deejgregor
added a commit
to OpenNMS/opennms
that referenced
this pull request
Nov 13, 2022
See testcontainers/testcontainers-java#6167 This change should be temporary until the above fix is released and we update. Created waitUntilReadyWrapped to make it less messy to make this change now and revert it later.
deejgregor
added a commit
to OpenNMS/opennms
that referenced
this pull request
Nov 13, 2022
See testcontainers/testcontainers-java#6167 This change should be temporary until the above fix is released and we update. Created waitUntilReadyWrapped to make it less messy to make this change now and revert it later.
deejgregor
added a commit
to OpenNMS/opennms
that referenced
this pull request
Nov 13, 2022
See testcontainers/testcontainers-java#6167 This change should be temporary until the above fix is released and we update. Created waitUntilReadyWrapped to make it less messy to make this change now and revert it later.
d23eaef
to
10056f1
Compare
core/src/main/java/org/testcontainers/containers/GenericContainer.java
Outdated
Show resolved
Hide resolved
eddumelendez
requested changes
Nov 30, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @deejgregor ! I have left a suggestion which can be applied to the rest of messages.
10056f1
to
5c8af15
Compare
This adds the original exception as the cause. It also adds the text "Wait strategy threw an exception." to each exception message. This addresses two issues: 1. The original exception from waitUntilContainerStarted was not being included as the cause in newly thrown exceptions in tryStart. The exceptions were not completely hidden because they were being logged, however, but the initial cause was less visible. 2. The exception messages focused on state that was found at the time the exception was received but did not mention that the waitUntilContainerStarted method threw an exception. Because of these issues, unless you look at the source or see the logs, it isn't clear that this was caused by an exception from waitUntilContainerStarted. In systems that might highlight the failure message and stack trace and not logs/console output (test failure reports, CI systems, etc.), it makes it harder to debug these issues. Updated tests to check for the updated messages as well as the exception from waitUntilContainerStarted.
5c8af15
to
78d961c
Compare
eddumelendez
approved these changes
Dec 14, 2022
thanks for your contribution @deejgregor ! This is now in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the original exception as the cause. It also adds the text "Wait strategy threw an exception." to each exception message.
This addresses two issues:
The original exception from waitUntilContainerStarted was not being included as the cause in newly thrown exceptions in tryStart. The exceptions were not completely hidden because they were being logged, however, but the initial cause was less visible.
The exception messages focused on state that was found at the time the exception was received but did not mention that the waitUntilContainerStarted method threw an exception.
Because of these two issues, unless you look at the source or see the logs, it isn't clear that this was caused by an exception from waitUntilContainerStarted. In test failure reports, CI systems, etc. that might highlight the failure message and not logs, this makes it harder to debug these issues.
Here is an example why including these details is useful:
test-results/junit/TEST-org.opennms.smoketest.OpenShiftCompatIT.xml
artifact if you search for the first instance ofERROR
, but this is, uh, not the best user experience. ;-) https://app.circleci.com/pipelines/github/OpenNMS/opennms/25469/workflows/5af07488-d835-4b46-91e9-0bbb6ee70940/jobs/198804/artifacts