mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
test: fix test datarace within helper broker. (#19974)
This commit is contained in:
@@ -46,12 +46,12 @@ func TestGenericNotifier(t *testing.T) {
|
|||||||
var notifiedWG sync.WaitGroup
|
var notifiedWG sync.WaitGroup
|
||||||
|
|
||||||
for i := 0; i < 6; i++ {
|
for i := 0; i < 6; i++ {
|
||||||
go func(wg *sync.WaitGroup) {
|
notifiedWG.Add(1)
|
||||||
wg.Add(1)
|
go func() {
|
||||||
|
defer notifiedWG.Done()
|
||||||
msg := notifier.WaitForChange(3 * time.Second)
|
msg := notifier.WaitForChange(3 * time.Second)
|
||||||
require.Equal(t, "we got an update and not a timeout", msg)
|
require.Equal(t, "we got an update and not a timeout", msg)
|
||||||
wg.Done()
|
}()
|
||||||
}(¬ifiedWG)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the routines have had time to start before sending the notify
|
// Ensure the routines have had time to start before sending the notify
|
||||||
|
|||||||
Reference in New Issue
Block a user