Skip to content
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

ExpectedSystemExit doesn't work in multi-threading environment #44

Open
akryvtsun opened this issue Aug 18, 2016 · 6 comments
Open

ExpectedSystemExit doesn't work in multi-threading environment #44

akryvtsun opened this issue Aug 18, 2016 · 6 comments

Comments

@akryvtsun
Copy link

akryvtsun commented Aug 18, 2016

In integration testing if a test is executed on the one thread but System.exit(...) is called on another ExpectedSystemExit work unstable. If the test is finished faster then another thread calls System.exit(...) then current ExpectedSystemExit implementation fails the test.

The solution is to delay the test thread till System.exit(...) is called or time out time is finished. It's possible to use java.util.concurrent.CountDownLatch for this but I couldn't find ability to do the latch count down somewhere in NoExitSecurityManager.

P.S. if ExpectedSystemExit work as a Rule in multi-threading environment isn't break any JUnit conventions I can prepare pull request for the fix.

@akryvtsun
Copy link
Author

akryvtsun commented Aug 19, 2016

@stefanbirkner FYI: I've implemented needed functionality in my code using your ProvideSecurityManager and my custom thread-friendly analog of your internal NoExitSecurityManager class.

@stefanbirkner
Copy link
Owner

Could you provide a pull request that fixes the issue? That would be very helpful.

@akryvtsun
Copy link
Author

@stefanbirkner thank you for interest. I'll provide PR.

@akryvtsun
Copy link
Author

akryvtsun commented Sep 29, 2016

@stefanbirkner pls, review provided PR with the fix
#46
All tests are green but some firebug check was failed and I can't clearly understand what exactly.

@stefanbirkner
Copy link
Owner

Thanks for the pull request. I cannot review it the next two weeks, but I review it afterwards.

@akryvtsun
Copy link
Author

@stefanbirkner NP. let me know if you will have some notes, remarks etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants