Skip to content

Commit c806d9e

Browse files
committed
Fix race in testOnSendCancelled
1 parent 9c516a0 commit c806d9e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

reactive/kotlinx-coroutines-reactive/test/PublishTest.kt

+3-6
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,10 @@ class PublishTest : TestBase() {
296296
expect(2)
297297
// Collector is ready
298298
send(1)
299-
expect(3)
300299
try {
301300
send(2)
302301
expectUnreached()
303302
} catch (e: CancellationException) {
304-
expect(7)
305303
// publisher cancellation is async
306304
latch.countDown()
307305
throw e
@@ -312,15 +310,14 @@ class PublishTest : TestBase() {
312310
val collectorLatch = Mutex(true)
313311
val job = launch {
314312
published.asFlow().buffer(0).collect {
315-
expect(4)
316313
collectorLatch.unlock()
317-
hang { expect(6) }
314+
hang { expect(4) }
318315
}
319316
}
320317
collectorLatch.lock()
321-
expect(5)
318+
expect(3)
322319
job.cancelAndJoin()
323320
latch.await()
324-
finish(8)
321+
finish(5)
325322
}
326323
}

0 commit comments

Comments
 (0)