NGAlert: Fix flaky test (#33415)

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
pull/33420/head
Ganesh Vernekar 4 years ago committed by GitHub
parent f5efe97763
commit be1affe0a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      pkg/services/ngalert/notifier/alertmanager_test.go

@ -5,6 +5,7 @@ import (
"errors"
"io/ioutil"
"os"
"sort"
"testing"
"time"
@ -284,7 +285,12 @@ func TestPutAlert(t *testing.T) {
// We take the "now" time from one of the UpdatedAt.
now := alerts[0].UpdatedAt
require.Equal(t, c.expAlerts(now), alerts)
expAlerts := c.expAlerts(now)
sort.Sort(types.AlertSlice(expAlerts))
sort.Sort(types.AlertSlice(alerts))
require.Equal(t, expAlerts, alerts)
})
}
}

Loading…
Cancel
Save