Skip to content

Commit cd9f4ca

Browse files
authored
Fix race condition in TestNotifierSendsUserIDHeader (#617)
1 parent 135b01b commit cd9f4ca

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/ruler/ruler_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net/http/httptest"
77
"sync"
88
"testing"
9+
"time"
910

1011
"github.com/prometheus/prometheus/pkg/labels"
1112

@@ -48,6 +49,10 @@ func TestNotifierSendsUserIDHeader(t *testing.T) {
4849
t.Fatal(err)
4950
}
5051
defer n.Stop()
52+
// Loop until notifier discovery syncs up
53+
for len(n.Alertmanagers()) == 0 {
54+
time.Sleep(10 * time.Millisecond)
55+
}
5156

5257
n.Send(&notifier.Alert{
5358
Labels: labels.Labels{labels.Label{Name: "alertname", Value: "testalert"}},

0 commit comments

Comments
 (0)