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
Support completing the test coroutine from outside the test thread.
This requires a call to invokeOnCompletion to get the completion state
from the other thread.
Changes:
- runBlockingTest now supports completing the test coroutine from
another thread
- success and failure path tests
While fixing this, a subtle non-determinism was discovered that would
lead to flakey tests. If another thread completed the test coroutine
*during* the cleanup checks it was possible to modify the state of the
test during the cleanup checks in a way that could expose false-positive
or false-negative results randomly.
To resolve this, a non-completed coroutine immediately after
advanceUntilIdle is now considered a failure, even if it completes
before the more aggressive cleanup checks. There is still a very brief
window (between advanceTimeBy and getResultIfKnown) that non-determinism
may be introduced, but it will fail with a descriptive error message at
on random executions directing the developer to resolve the
non-determinstic behavior.
Note: testWithOddlyCompletingJob_fails may fail when the implementation
of runBlockingTest changes (it's very tightly coupled).
0 commit comments