bbaldino
09/10/2020, 8:02 PMdelay
call inside of a should
block and found it never seems to pick back up after the delay
, is there a better way to do that? (I don't necessarily need it for the test, but was 'testing' the test and noticed the behavior)sam
09/10/2020, 8:20 PMbbaldino
09/10/2020, 8:26 PMdelay
sam
09/10/2020, 8:26 PMsam
09/10/2020, 8:26 PMshould("foo") { delay(1000) error("boom") }
won't failbbaldino
09/10/2020, 8:28 PMbbaldino
09/10/2020, 8:30 PMsam
09/10/2020, 8:31 PMbbaldino
09/10/2020, 8:37 PMbbaldino
09/10/2020, 8:38 PMshould("notify waiters").config(timeout = 5.seconds) {
val result = async {
shutdownService.waitForShutdown()
true
}
println("before delay")
delay(1000)
shutdownService.beginShutdown()
println("after!")
result.await() shouldBe true
}
bbaldino
09/10/2020, 8:39 PMshutdownService
is:
class ShutdownServiceImpl : ShutdownService {
private val shutdownStarted = AtomicBoolean(false)
private val shutdownSync = CountDownLatch(1)
override fun beginShutdown() {
if (shutdownStarted.compareAndSet(false, true)) {
shutdownSync.countDown()
}
}
fun waitForShutdown() {
shutdownSync.await()
}
}
bbaldino
09/10/2020, 8:39 PMasync
launch in the same thread? If so that may be blocking things sometimes? But it does print "before delay"bbaldino
09/10/2020, 8:40 PMbbaldino
09/10/2020, 8:40 PMbbaldino
09/10/2020, 8:45 PMsam
09/10/2020, 8:58 PMLeoColman
09/11/2020, 4:00 AM