mirror of https://github.com/portainer/portainer
fix(scheduler): fix a data race in a scheduler unit test EE-2715 (#6628)
parent
78f7cd0d6c
commit
f8fd28bb61
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue