I am currently using Eventually but still with tha...
# kotest
a
I am currently using Eventually but still with that, there are times when test fails, the Code under test schedule some task on a separate thread pool, which is supposed to completed with 2-3 seconds yet depending upon the load on CI agent where these test are running they can take say 7-8 second to complete resulting in test failure, one option is to increase timeout duration in eventually above 8 second, but depending upon the number of such test this will increase the overall build time.
j
Those tests with the long delay should yield resources to the other tests that are actively doing things, right @sam?
s
The whole point of eventually is that it won't take any longer that necessary
As soon as the test passes, it will yield
j
That too, but
delay
should give up the coroutine while it's delaying too I think
s
Yes
Give up the thread
The coroutine suspends
j
Yeah so personally I don't see the problem with a long timeout and a reasonable interval 😂😅
t
we had a similar problem and settled down changing the executor of async tasks in test to sync. however our stack trace does not include coroutines and uses spring, so we just slapped a bean
Copy code
@Bean
  @Primary
  fun asyncExecutor(): ExecutorService {
    return com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService()
  }
and lived happily ever after. we tried increasing the timeout on
eventually
but after the 3rd or 4th time we patched flaking tests that way we want a more stable solution