mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
fix(scheduler): fix a data race in a scheduler unit test EE-2715 (#6628)
This commit is contained in:
parent
78f7cd0d6c
commit
f8fd28bb61
1 changed files with 3 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue