jvmTest.JobStructuredJoinStressTest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-coroutines-core-metadata Show documentation
Show all versions of kotlinx-coroutines-core-metadata Show documentation
Coroutines support libraries for Kotlin
/*
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.coroutines
import org.junit.*
/**
* Test a race between job failure and join.
*
* See [#1123](https://github.com/Kotlin/kotlinx.coroutines/issues/1123).
*/
class JobStructuredJoinStressTest : TestBase() {
private val nRepeats = 1_000 * stressTestMultiplier
@Test
fun testStress() {
repeat(nRepeats) {
assertFailsWith {
runBlocking {
// launch in background
val job = launch(Dispatchers.Default) {
throw TestException("OK") // crash
}
assertFailsWith {
job.join()
}
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy