Browse Source

Stop interference from test driver.

main
Stian Fredrik Aune 2 years ago
parent
commit
6da77a2289
  1. 9
      ykonsole-core/src/main/kotlin/net/aiterp/git/ykonsole2/infrastructure/testing/TestDriver.kt

9
ykonsole-core/src/main/kotlin/net/aiterp/git/ykonsole2/infrastructure/testing/TestDriver.kt

@ -26,6 +26,11 @@ class TestDriver(private val secondLength: Duration) : ActiveDriver() {
)
override suspend fun onCommand(command: Command, output: FlowBus<Event>) {
if (!connected && command !is ConnectCommand) {
// Don't interfere with other drivers
return
}
log.info("Received command: $command")
val ev = when (command) {
is ConnectCommand -> {
@ -56,8 +61,8 @@ class TestDriver(private val secondLength: Duration) : ActiveDriver() {
SkipCommand -> null
StartCommand -> if (connected) Started.also { running = true } else null
StopCommand -> if (connected) Stopped.also { running = false } else null
StartCommand -> Started.also { running = true }
StopCommand -> Stopped.also { running = false }
}
ev?.let { output.emit(it) }

Loading…
Cancel
Save