Rename `alerts` to `expectedAlerts` in the test case input

Signed-off-by: gotjosh <josue.abreu@gmail.com>
pull/13980/head
gotjosh 2024-04-30 12:43:09 +01:00
parent f63dbc3db2
commit 05ca082b07
No known key found for this signature in database
GPG Key ID: A6E1DDE38FF3C74E
1 changed files with 5 additions and 5 deletions

View File

@ -401,7 +401,7 @@ func TestForStateRestore(t *testing.T) {
type testInput struct { type testInput struct {
name string name string
restoreDuration time.Duration restoreDuration time.Duration
alerts []*Alert expectedAlerts []*Alert
num int num int
noRestore bool noRestore bool
@ -414,7 +414,7 @@ func TestForStateRestore(t *testing.T) {
{ {
name: "normal restore (alerts were not firing)", name: "normal restore (alerts were not firing)",
restoreDuration: 15 * time.Minute, restoreDuration: 15 * time.Minute,
alerts: rule.ActiveAlerts(), expectedAlerts: rule.ActiveAlerts(),
downDuration: 10 * time.Minute, downDuration: 10 * time.Minute,
}, },
{ {
@ -426,12 +426,12 @@ func TestForStateRestore(t *testing.T) {
{ {
name: "no active alerts", name: "no active alerts",
restoreDuration: 50 * time.Minute, restoreDuration: 50 * time.Minute,
alerts: []*Alert{}, expectedAlerts: []*Alert{},
}, },
{ {
name: "test the grace period", name: "test the grace period",
restoreDuration: 25 * time.Minute, restoreDuration: 25 * time.Minute,
alerts: []*Alert{}, expectedAlerts: []*Alert{},
gracePeriod: true, gracePeriod: true,
before: func() { before: func() {
for _, duration := range []time.Duration{10 * time.Minute, 15 * time.Minute, 20 * time.Minute} { for _, duration := range []time.Duration{10 * time.Minute, 15 * time.Minute, 20 * time.Minute} {
@ -496,7 +496,7 @@ func TestForStateRestore(t *testing.T) {
require.Equal(t, opts.ForGracePeriod, e.ActiveAt.Add(alertForDuration).Sub(restoreTime)) require.Equal(t, opts.ForGracePeriod, e.ActiveAt.Add(alertForDuration).Sub(restoreTime))
} }
default: default:
exp := tt.alerts exp := tt.expectedAlerts
require.Equal(t, len(exp), len(got)) require.Equal(t, len(exp), len(got))
sortAlerts(exp) sortAlerts(exp)
sortAlerts(got) sortAlerts(got)