You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We got a failure in Jenkins:
```
ASSERT one_shot_success
--------------------------------------------------------------------------------
[failure] Error one_shot_success: expecting
true, got
false.
```
The test schedules a job for 1 second in the future and then checks that
it took `(0.99, 2.01) s` to run it.
But the scheduler, and indeed Thread.delay cannot make such guarantees.
It can only ensure that the job is scheduled *at least* 1 s in the future.
If the system is busy it can take 2s, 30s, 10m, etc. the kernel provides
no upper bound, this is not a real-time operating system.
Replace the strict check with a timeout based one instead: wait up to a
maximum allowed time, and then check how soon the callback actually got
invoked (i.e. that it didn't run too early).
We need the maximum allowed time because we don't want the test to be
stuck forever, but we also want the test to stop as soon as the callback
is executed, i.e. so it doesn't needlessly wait a minute on each test if
the scheduler actually finished in 1s.
Signed-off-by: Edwin Török <[email protected]>
0 commit comments