Skip to content

Commit

Permalink
test: before isAlive test, do waitFor with timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
iseki0 committed Mar 22, 2024
1 parent 8997b3e commit 7ff6f55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/test/kotlin/space/iseki/cmdpipe/CmdTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import java.io.IOException
import java.nio.charset.Charset
import java.time.Duration
import java.util.concurrent.ExecutionException
import java.util.concurrent.TimeUnit
import kotlin.test.assertFalse
import kotlin.test.assertTrue

Expand Down Expand Up @@ -66,7 +67,8 @@ class CmdTest {
val p = node.process
assertTrue { p.isAlive }
node.stopAll(true)
assertFalse { p.isAlive }
assertTrue(p.waitFor(1, TimeUnit.SECONDS))
assertFalse(p.isAlive)
assertTimeoutPreemptively(Duration.ofSeconds(1)) {
try {
println(stdout.future().get().prependIndent("> "))
Expand Down

0 comments on commit 7ff6f55

Please sign in to comment.