-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Document that timeouts notice test thread interrupt status #3426
Comments
Hi @dkfellows, Congratulations on creating your first issue for JUnit 5! 👍 We'll see how we can improve the documentation in 5.11. Thanks |
I could not reproduce this issue. Since #1688 which was released in 5.4, the interrupted flag is reset after test execution. If you enable logging, you should see an entry similar to the following in case the test did not timeout:
If the test did time out, the flag is cleared earlier and no entry is being logged. @dkfellows Which version of JUnit are you using? Could you please provide a more complete reproducer? |
If you would like us to be able to process this issue, please provide the requested information. If the information is not provided within the next 3 weeks, we will be unable to proceed and this issue will be closed. |
Closing due to lack of requested feedback. If you would like to proceed with your contribution, please provide the requested information and we will re-open this issue. |
Please at least document that a test annotated with
@Timeout
must not complete in the interrupted state (preferably in the documentation for the annotation). That will at least then save someone else a few days of work trying to find out why things were blowing up despite apparently working.The problem was I had a test case that effectively did this:
and JUnit 5 was saying that the test was failing... much later on in the test suite. This was intensely confusing! Once I knew what the problem was, clearing the interrupt status was trivially easy (I could ensure this would only happen in a way that was successful).
(The real test was a lot more complex which is why it was so much harder to spot.)
Better yet, the decision about whether a test timed out shouldn't be based on whether the interrupted flag is set on that thread, but if that's how it has to be then let us know so that we can at least ensure that our test code doesn't trigger spurious failures. Hence the simple documentation enhancement request for the annotation.
The text was updated successfully, but these errors were encountered: