Skip to content

Conversation

@dwnusbaum
Copy link
Member

@dwnusbaum dwnusbaum commented Aug 13, 2020

While trying to investigate test failures in jenkinsci/workflow-durable-task-step-plugin#139 I realized that #166 made it so that any exceptions thrown by env.dispose() supersede any exceptions thrown by the test itself.

This means that if a regular test assertion fails while the test is in a state that also causes env.dispose() to fail (e.g. an assertion fails while a build is running, which means that the build cannot be cleaned up Windows because the log is still open), only the cleanup failure is reported, which makes it difficult to diagnose the real issue.

This PR tracks exceptions thrown by tests and makes sure that they are always thrown as the top-level exception. Additional exceptions thrown by JenkinsRule.after are reported as suppressed exceptions.

Tested in jenkinsci/workflow-durable-task-step-plugin#139, see this commit and this comment showing that the assertion is the top-level exception and the cleanup failure is suppressed.

Copy link
Contributor

@slonopotamus slonopotamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello from the author of #166, your change is definitely an improvement.

@jglick jglick added the bug label Aug 21, 2020
@jglick jglick merged commit 7ee1f23 into jenkinsci:master Aug 21, 2020
@dwnusbaum dwnusbaum deleted the always-throw-test-exceptions branch August 24, 2020 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants