Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force runbooks names to equal alerts names #654

Merged
merged 1 commit into from
Aug 15, 2023
Merged
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
16 changes: 9 additions & 7 deletions tests/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,11 @@ var _ = Describe("Metrics", func() {
for _, rule := range group.Rules {
if rule.Alert != "" {
Expect(rule.Annotations).To(HaveKeyWithValue("summary", Not(BeEmpty())),
fmt.Sprintf("%s summary is missing or empty", rule.Alert))
Expect(rule.Annotations).To(HaveKeyWithValue("runbook_url", Not(BeEmpty())),
fmt.Sprintf("%s runbook_url is missing or empty", rule.Alert))
"%s summary is missing or empty", rule.Alert)
Expect(rule.Annotations).To(HaveKey("runbook_url"),
"%s runbook_url is missing", rule.Alert)
Expect(rule.Annotations).To(HaveKeyWithValue("runbook_url", HaveSuffix(rule.Alert)),
"%s runbook is not equal to alert name", rule.Alert)
resp, err := http.Head(rule.Annotations["runbook_url"])
Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("%s runbook is not available", rule.Alert))
Expect(resp.StatusCode).Should(Equal(http.StatusOK), fmt.Sprintf("%s runbook is not available", rule.Alert))
Expand All @@ -221,13 +223,13 @@ var _ = Describe("Metrics", func() {
for _, rule := range group.Rules {
if rule.Alert != "" {
Expect(rule.Labels).To(HaveKeyWithValue("severity", BeElementOf("info", "warning", "critical")),
fmt.Sprintf("%s severity label is missing or not valid", rule.Alert))
"%s severity label is missing or not valid", rule.Alert)
Expect(rule.Labels).To(HaveKeyWithValue("operator_health_impact", BeElementOf("none", "warning", "critical")),
fmt.Sprintf("%s operator_health_impact label is missing or not valid", rule.Alert))
"%s operator_health_impact label is missing or not valid", rule.Alert)
Expect(rule.Labels).To(HaveKeyWithValue("kubernetes_operator_part_of", "kubevirt"),
fmt.Sprintf("%s kubernetes_operator_part_of label is missing or not valid", rule.Alert))
"%s kubernetes_operator_part_of label is missing or not valid", rule.Alert)
Expect(rule.Labels).To(HaveKeyWithValue("kubernetes_operator_component", "ssp-operator"),
fmt.Sprintf("%s kubernetes_operator_component label is missing or not valid", rule.Alert))
"%s kubernetes_operator_component label is missing or not valid", rule.Alert)
}
}
}
Expand Down