Skip to content

Commit

Permalink
Add test cases for runbook URLs (#2079)
Browse files Browse the repository at this point in the history
Signed-off-by: assafad <aadmi@redhat.com>
  • Loading branch information
assafad committed Feb 21, 2022
1 parent 4d620ac commit 855e6d9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"reflect"
"strconv"
"time"
Expand Down Expand Up @@ -1004,6 +1005,31 @@ var _ = Describe("ALL Operator tests", func() {
}, 3*time.Minute, 1*time.Second).Should(BeNumerically("==", expectedFailingCrons-i))
}
})

It("[test_id:8259] Alerts runbooks should have available URLs", func() {
promRule := &promv1.PrometheusRule{
ObjectMeta: metav1.ObjectMeta{
Name: "prometheus-cdi-rules",
Namespace: f.CdiInstallNs,
},
}
err := f.CrClient.Get(context.TODO(), crclient.ObjectKeyFromObject(promRule), promRule)
Expect(err).ToNot(HaveOccurred())
for _, group := range promRule.Spec.Groups {
if group.Name == "cdi.rules" {
for _, rule := range group.Rules {
if len(rule.Alert) > 0 {
Expect(rule.Annotations).ToNot(BeNil())
url, ok := rule.Annotations["runbook_url"]
Expect(ok).To(BeTrue())
resp, err := http.Head(url)
Expect(err).ToNot(HaveOccurred())
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
}
}
}
}
})
})

var _ = Describe("Operator cert config tests", func() {
Expand Down

0 comments on commit 855e6d9

Please sign in to comment.