NGAlert: Fix flaky test (#33415)

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
This commit is contained in:
Ganesh Vernekar 2021-04-27 17:03:22 +05:30 committed by GitHub
parent f5efe97763
commit be1affe0a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
})
}
}