@@ -15,7 +15,7 @@ import (
15
15
dto "github.com/prometheus/client_model/go"
16
16
"github.com/prometheus/common/expfmt"
17
17
18
- "k8s.io/api/core/v1"
18
+ v1 "k8s.io/api/core/v1"
19
19
kapierrs "k8s.io/apimachinery/pkg/api/errors"
20
20
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21
21
"k8s.io/apimachinery/pkg/util/wait"
@@ -150,6 +150,22 @@ var _ = g.Describe("[Feature:Prometheus][Conformance] Prometheus", func() {
150
150
return true , nil
151
151
})).NotTo (o .HaveOccurred ())
152
152
})
153
+ g .It ("should have a Watchdog alert in firing state" , func () {
154
+ oc .SetupProject ()
155
+ ns := oc .Namespace ()
156
+ execPodName := e2e .CreateExecPodOrFail (oc .AdminKubeClient (), ns , "execpod" , func (pod * v1.Pod ) { pod .Spec .Containers [0 ].Image = "centos:7" })
157
+ defer func () { oc .AdminKubeClient ().CoreV1 ().Pods (ns ).Delete (execPodName , metav1 .NewDeleteOptions (1 )) }()
158
+
159
+ tests := map [string ][]metricTest {
160
+ // should have constantly firing a watchdog alert
161
+ `ALERTS{alertstate="firing",alertname="Watchdog"}` : {metricTest {greaterThanEqual : true , value : 1 }},
162
+ // should be only one watchdog alert (this is a workaround as metricTest doesn't offer equality operator)
163
+ `ALERTS{alertstate="firing",alertname="Watchdog",severity="none"}` : {metricTest {greaterThanEqual : false , value : 2 }},
164
+ }
165
+ runQueries (tests , oc , ns , execPodName , url , bearerToken )
166
+
167
+ e2e .Logf ("Watchdog alert is firing: %s" , bearerToken )
168
+ })
153
169
})
154
170
})
155
171
0 commit comments