Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ inactive = 0`,
// When there are no alerts we add an empty PartialResult just to have consistent output
if len(overall.PartialResults) == 0 {
sc := result.NewPartialResult()
// We already make sure it's valid
//nolint: errcheck
sc.SetDefaultState(noAlertsState)
sc.Output = "No alerts retrieved"
overall.AddSubcheck(sc)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/alert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ exit status 2
w.WriteHeader(http.StatusOK)
w.Write(loadTestdata(alertTestDataSet2))
})),
args: []string{"run", "../main.go", "alert", "--name", "NoSuchAlert"},
args: []string{"run", "../main.go", "alert", "--name", "NoSuchAlert", "-T", "3"},
expected: `[UNKNOWN] - 0 Alerts: 0 Firing - 0 Pending - 0 Inactive
\_ [UNKNOWN] No alerts retrieved
|total=0 firing=0 pending=0 inactive=0
Expand All @@ -179,7 +179,7 @@ exit status 3
w.WriteHeader(http.StatusOK)
w.Write(loadTestdata(alertTestDataSet2))
})),
args: []string{"run", "../main.go", "alert", "--name", "InactiveAlert", "--problems"},
args: []string{"run", "../main.go", "alert", "--name", "InactiveAlert", "--problems", "-T", "3"},
expected: `[UNKNOWN] - 0 Alerts: 0 Firing - 0 Pending - 0 Inactive
\_ [UNKNOWN] No alerts retrieved
|total=0 firing=0 pending=0 inactive=0
Expand Down