Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm committed Apr 22, 2024
1 parent 5a9f282 commit cf03987
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ class ProcessorUnitTest {

val onFailure = OnFailure { threw = it }
val onSuccess = OnSuccess<Reply.Success.OK> { invocationSuccess++ }

ctrl.enqueue(TorCmd.Authenticate(TestUtils.AUTH_PASS), onFailure, onSuccess)
ctrl.enqueue(TorCmd.SetEvents(TorEvent.entries), onFailure, onSuccess)
ctrl.enqueue(TorCmd.Signal.Heartbeat, onFailure, onSuccess)
ctrl.enqueue(TorCmd.Signal.Heartbeat, onFailure, onSuccess)
ctrl.enqueue(TorCmd.Signal.Heartbeat, onFailure, onSuccess)

// Suspends test until non-suspending complete
ctrl.executeAsync(TorCmd.Signal.Dump)
Expand All @@ -79,12 +82,12 @@ class ProcessorUnitTest {
process.destroy()
}

withContext(Dispatchers.Default) { delay(25.milliseconds) }
withContext(Dispatchers.Default) { delay(50.milliseconds) }

threw?.let { throw it }

// All commands for our test executed successfully
assertEquals(5, invocationSuccess++)
assertEquals(7, invocationSuccess)

// Ensure that given our flurry of commands, a single processor
// coroutine was started to handle them all.
Expand Down

0 comments on commit cf03987

Please sign in to comment.