diff --git a/pkg/services/ngalert/notifier/alertmanager_test.go b/pkg/services/ngalert/notifier/alertmanager_test.go index a3b0ebece1d..5e2f10e7420 100644 --- a/pkg/services/ngalert/notifier/alertmanager_test.go +++ b/pkg/services/ngalert/notifier/alertmanager_test.go @@ -346,10 +346,6 @@ func TestPutAlert(t *testing.T) { // implement a custom maintenance function for silences, because we snapshot // our data differently, so we test that functionality. func TestSilenceCleanup(t *testing.T) { - // TODO: This test intermittently fails. Un-skip me! - // https://github.com/grafana/grafana/issues/47470 - t.Skip("intermittent test") - require := require.New(t) oldRetention := retentionNotificationsAndSilences @@ -390,10 +386,10 @@ func TestSilenceCleanup(t *testing.T) { makeSilence("", "tests", dt(now.Add(5*time.Hour)), dt(now.Add(6*time.Hour)), matchers), // Active now makeSilence("", "tests", dt(now.Add(-5*time.Hour)), dt(now.Add(6*time.Hour)), matchers), - // Expiring soon - makeSilence("", "tests", dt(now.Add(-5*time.Hour)), dt(now.Add(2*time.Second)), matchers), + // Expiring soon. + makeSilence("", "tests", dt(now.Add(-5*time.Hour)), dt(now.Add(5*time.Second)), matchers), // Expiring *very* soon - makeSilence("", "tests", dt(now.Add(-5*time.Hour)), dt(now.Add(20*time.Millisecond)), matchers), + makeSilence("", "tests", dt(now.Add(-5*time.Hour)), dt(now.Add(2*time.Second)), matchers), } for _, s := range silences { @@ -407,12 +403,12 @@ func TestSilenceCleanup(t *testing.T) { found, err := am.ListSilences(nil) require.NoError(err) return len(found) == 3 - }, 1500*time.Millisecond, 150*time.Millisecond) + }, 3*time.Second, 150*time.Millisecond) // Wait again for another silence to expire. require.Eventually(func() bool { found, err := am.ListSilences(nil) require.NoError(err) return len(found) == 2 - }, 2*time.Second, 150*time.Millisecond) + }, 6*time.Second, 150*time.Millisecond) }