diff --git a/helper/broker/notify_test.go b/helper/broker/notify_test.go index 69b55d808..cda4e626d 100644 --- a/helper/broker/notify_test.go +++ b/helper/broker/notify_test.go @@ -46,12 +46,12 @@ func TestGenericNotifier(t *testing.T) { var notifiedWG sync.WaitGroup for i := 0; i < 6; i++ { - go func(wg *sync.WaitGroup) { - wg.Add(1) + notifiedWG.Add(1) + go func() { + defer notifiedWG.Done() msg := notifier.WaitForChange(3 * time.Second) 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