Skip to content

Commit

Permalink
Fix a flaky test (#4227)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkhalanskyjb authored Sep 23, 2024
1 parent cf4fcd1 commit eac92c0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions kotlinx-coroutines-core/jvm/test/JobChildStressTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ class JobChildStressTest : TestBase() {
launch(pool + deferred) {
deferred.complete(Unit) // Transition deferred into "completing" state waiting for current child
// **Asynchronously** submit task that launches a child so it races with completion
pool.executor.execute {
rogueJob.set(launch(pool + deferred) {
throw TestException("isCancelled: ${coroutineContext.job.isCancelled}")
})
try {
pool.executor.execute {
rogueJob.set(launch(pool + deferred) {
throw TestException("isCancelled: ${coroutineContext.job.isCancelled}")
})
}
} catch (_: RejectedExecutionException) {
// This is expected if the pool is closed
}
}

Expand Down

0 comments on commit eac92c0

Please sign in to comment.