-
Notifications
You must be signed in to change notification settings - Fork 7.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
Non-deterministic test failure: schedulers #1654
Comments
I was watching this test run and the CloudBees instance was very slow. |
this test can be made deterministic by using the test scheduler for interval(..) instead of the computation scheduler - dmgd@e95d4a4 |
This is a test for the actual Scheduler implementation in |
Sorry, I should have been more clear in my earlier comment. I'm not talking about using the test scheduler in place of the scheduler under test. Currently the call to interval(..) is The scheduler under test will still observe all emissions, and the original issue #431 that when the observing thread requests unsubscription then the original emitting thread never sees isUnsubscribed() == true is still tested (because if it's not then the second call to advanceTime() will result in further emissions!) With the current test there is always going to be a chance that the computation thread will get some time to generate more emissions -- we don't have control over the way that the underlying system schedules threads, so we can't control that!! There are other ways to accomplish determinism here. E.g. You could put a countdown latch inside the map--
--however this really just does exactly the same thing as using the test scheduler: it ensures that once the second interval(..) emission has been emitted, that the thread on which it is emitted does not get a chance to run until the thread on which the emission is observed has had a chance to react to the emission. Either way works fine and results in the test being deterministic! |
Haven't seen this fail since we moved to travis so closing. |
The text was updated successfully, but these errors were encountered: