File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -357,13 +357,26 @@ func TestStateMachineDaemonEvents(t *testing.T) {
357
357
}
358
358
stateMachine := NewStateMachine (cfg )
359
359
360
+ // Before we start up the state machine, we'll assert that the machine
361
+ // is not running.
362
+ require .False (t , stateMachine .IsRunning ())
363
+
360
364
// As we're triggering internal events, we'll also subscribe to the set
361
365
// of new states so we can assert as we go.
362
366
stateSub := stateMachine .RegisterStateEvents ()
363
367
defer stateMachine .RemoveStateSub (stateSub )
364
368
365
369
stateMachine .Start (ctx )
366
- defer stateMachine .Stop ()
370
+ defer func () {
371
+ stateMachine .Stop ()
372
+
373
+ // After we stop the state machine, we expect it to no longer be
374
+ // running.
375
+ require .False (t , stateMachine .IsRunning ())
376
+ }()
377
+
378
+ // The state machine should now be running.
379
+ require .True (t , stateMachine .IsRunning ())
367
380
368
381
// As soon as we send in the daemon event, we expect the
369
382
// disable+broadcast events to be processed, as they are unconditional.
You can’t perform that action at this time.
0 commit comments