From 151f6e0ed6e9e60c0c667da294c099bc3ece8047 Mon Sep 17 00:00:00 2001 From: gotjosh Date: Tue, 30 Apr 2024 12:17:56 +0100 Subject: [PATCH] Add an assertion on the count of alerts before adding an active alert Signed-off-by: gotjosh --- rules/alerting_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/alerting_test.go b/rules/alerting_test.go index a3f97b2a4..28b4f2cdc 100644 --- a/rules/alerting_test.go +++ b/rules/alerting_test.go @@ -1038,6 +1038,8 @@ func TestAlertingRule_ActiveAlertsCount(t *testing.T) { labels.EmptyLabels(), labels.EmptyLabels(), "", true, nil, ) + require.Equal(t, 0, rule.ActiveAlertsCount()) + // Set an active alert. lbls := labels.FromStrings("a1", "1") h := lbls.Hash()