diff --git a/api/scheduler/scheduler_test.go b/api/scheduler/scheduler_test.go index 2d66f2e6b..b7159a1a1 100644 --- a/api/scheduler/scheduler_test.go +++ b/api/scheduler/scheduler_test.go @@ -53,12 +53,15 @@ func Test_JobShouldStop_UponError(t *testing.T) { defer s.Shutdown() var acc int + ch := make(chan struct{}) s.StartJobEvery(jobInterval, func() error { acc++ + close(ch) return fmt.Errorf("failed") }) <-time.After(3 * jobInterval) + <-ch assert.Equal(t, 1, acc, "job stop after the first run because it returns an error") }