@@ -162,14 +162,14 @@ var _ = g.Describe("[Feature:Prometheus][Conformance] Prometheus", func() {
162162 defer func () { oc .AdminKubeClient ().CoreV1 ().Pods (ns ).Delete (execPodName , metav1 .NewDeleteOptions (1 )) }()
163163
164164 tests := map [string ][]metricTest {
165- // should have constantly firing a watchdog alert
165+ // should have a constantly firing watchdog alert
166166 `ALERTS{alertstate="firing",alertname="Watchdog"}` : {metricTest {greaterThanEqual : true , value : 1 }},
167167 // should be only one watchdog alert (this is a workaround as metricTest doesn't offer equality operator)
168168 `ALERTS{alertstate="firing",alertname="Watchdog",severity="none"}` : {metricTest {greaterThanEqual : false , value : 2 }},
169169 }
170170 runQueries (tests , oc , ns , execPodName , url , bearerToken )
171171
172- e2e .Logf ("Watchdog alert is firing: %s" , bearerToken )
172+ e2e .Logf ("Watchdog alert is firing" )
173173 })
174174 g .It ("should have non-Pod host cAdvisor metrics" , func () {
175175 oc .SetupProject ()
@@ -195,6 +195,22 @@ var _ = g.Describe("[Feature:Prometheus][Conformance] Prometheus", func() {
195195 }
196196 runQueries (tests , oc , ns , execPodName , url , bearerToken )
197197 })
198+ g .It ("should report less than two alerts in firing or pending state" , func () {
199+ oc .SetupProject ()
200+ ns := oc .Namespace ()
201+ execPodName := e2e .CreateExecPodOrFail (oc .AdminKubeClient (), ns , "execpod" , func (pod * v1.Pod ) { pod .Spec .Containers [0 ].Image = "centos:7" })
202+ defer func () { oc .AdminKubeClient ().CoreV1 ().Pods (ns ).Delete (execPodName , metav1 .NewDeleteOptions (1 )) }()
203+
204+ // needed for cluster to settle and have metrics and alerts usable
205+ time .Sleep (5 * time .Minute )
206+
207+ tests := map [string ][]metricTest {
208+ // should be checking there is no more than 1 alerts firing.
209+ // Checking for specific alert is done in "should have a Watchdog alert in firing state".
210+ `sum(ALERTS{alertstate=~"firing|pending"})` : {metricTest {greaterThanEqual : false , value : 2 }},
211+ }
212+ runQueries (tests , oc , ns , execPodName , url , bearerToken )
213+ })
198214 })
199215})
200216
0 commit comments