Description
Run Test Timeout Issues
The new 10s runTest timeout which was introduced by #3603 is currently creating a lot of issues.
There are various discussions about it here:
- Consider lowering
runTest
default timeout #3270 - https://kotlinlang.slack.com/archives/C1CFAFJSK/p1688240798449439
And it boils down to basically this:
Users of ByteBuddy (for instance mockk users) face a very long initialization phase on the very first mocking initialization.
Example
For a Mac M1 Max, this test:
@Test
fun myMockingTest() {
measureTime {
mockk<UUID>()
}.also {
println("That took $it")
}
}
Takes about 1.5 seconds on my machine. CI machines are often times slower than that and might run compilations in parallel or even run multiple projects at once using virtualization.
This has lead to the fact that we do see a lot of sporadically failing CI jobs for tests which don't do much, basides switching to an IO dispatcher to write to a test database.
Proposed Solution
I proposed several solutions here:
https://kotlinlang.slack.com/archives/C1CFAFJSK/p1688326989830229?thread_ts=1688240798.449439&cid=C1CFAFJSK
With my preferred one being:
Making the test timeout configurable through a global option (i.e. an env variable that can be set for all tests from gradle).
That way when running tests locally they could quickly time out but depending on the setup, developers could configure a longer time on the CI where they know that the machine is actually slow