Skip to content

Commit

Permalink
Amend flaky test conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rken committed Jan 30, 2025
1 parent 926b9d0 commit 70c8202
Showing 1 changed file with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,29 +446,27 @@ class SharedResourceTest : BaseTest() {
(1..100).map { i ->
val jobs = mutableSetOf<Job>()

launch(Dispatchers.IO) {
sr.get()

launch(Dispatchers.IO) {
try {
sr.get().close()
} catch (e: Exception) {
log { "Thrown ${e.asLog()}" }
(e is CancellationException) shouldBe true
}
}.also { jobs.add(it) }
sr.get()

launch(Dispatchers.IO) {
shouldNotThrowAny {
sr.close()
}
}.also { jobs.add(it) }
launch(Dispatchers.IO) {
try {
sr.get().close()
} catch (e: Exception) {
log { "Thrown ${e.asLog()}" }
(e is CancellationException) shouldBe true
}
}.also { jobs.add(it) }

launch(Dispatchers.IO) {
shouldNotThrowAny {
sr.close()
}
}.also { jobs.add(it) }

jobs.joinAll()
}

sr.isClosed shouldBe true
sr.close()
sr.isClosed shouldBe true
}
}
}

0 comments on commit 70c8202

Please sign in to comment.