I have tests written using the Kotest framework. I...
# kotest
g
I have tests written using the Kotest framework. I want to inform the framework that if it takes more than 5 seconds to run some test, then it should stop the test as a failed one. So I wrote an object
Copy code
object KotestProjectConfig : AbstractProjectConfig() {
    override val timeout: Duration = 5.seconds
    override val parallelism: Int = 4
}
and put it in the root package. But when I run the tests, there was a test that did not finish even after 50 minutes of execution (usually the tests take no more than a 1-2 seconds to either success or fail). I know where the bug is, but I'm wondering how to make Kotest fail tests that run long enough. What am I doing wrong? How to specify the timeout?
a
of course the Kotest functionality should work, I'm not sure what to suggest to resolve that, but as an alternative you could set a global timeout for tests using Gradle
Copy code
// build.gradle.kts

import java.time.Duration

tasks.withType<Test>().configureEach {
  timeout.set(Duration.ofMinutes(30))
}
g
OK. Here is a MRE. If you run
javaTest
, you'll see that the first test completes instantly (a lot less than 1 second), whereas the second one takes forever to complete. But you can also see configuration object with specified timeout. But the timeout will be violated for some reason. Maybe, now someone has an idea of what is wrong?
s
Can you file a ticket on kotest and we can fix this bug.
g
OK. Just a minute!
s
Thank you