Emil Kantis
10/29/2022, 10:38 AMContainerTimeoutTest is flaky and I can't figure out why 😕 Putting a breakpoint at TimeoutInterceptor:34 consistently causes the same failuremitch
10/29/2022, 12:15 PMeventually helps? that seems like it’s a race condition between test asserting too early and interceptor not hitEmil Kantis
10/29/2022, 12:18 PMEmil Kantis
10/29/2022, 12:18 PMTimeoutCancellationException sometimes being caught by the TestInvocationInterceptor instead of the TimeoutInterceptormitch
10/29/2022, 12:24 PMmitch
10/29/2022, 12:24 PMmitch
10/29/2022, 12:36 PMEmil Kantis
10/29/2022, 12:36 PMmitch
10/29/2022, 12:40 PMTestTimeoutException we should only introspect that.. The problem seems like a lot of function in kotest piggiback on withTimeout and then catching the timeout ex and translating that to the exception type..mitch
10/29/2022, 12:41 PMwithKotestTimeout or something like so. naming is hardmitch
10/29/2022, 12:42 PMEmil Kantis
10/29/2022, 12:43 PMEmil Kantis
10/29/2022, 12:43 PMTestTimeoutException?Emil Kantis
10/29/2022, 12:45 PMmitch
10/29/2022, 12:51 PMsuspend fun withKotestTimeout(duration: Duration, onTimeout: suspend () -> Throwable, fn: suspend () -> T): T {
val currentTime = ...
val fallthroughAt = currentTime + duration
val eventuallyValue = async { fn() }
while (!eventuallyValue.isCompleted) {
if (now() < fallthroughAt) {
delay(25.milliseconds)
} else {
onTimeout()
}
}
eventuallyValue.await()
}Emil Kantis
10/29/2022, 12:52 PMmitch
10/29/2022, 12:53 PMmitch
10/29/2022, 12:53 PMEmil Kantis
10/29/2022, 1:24 PMsam
11/01/2022, 2:51 AM