-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
* Apply operator-observability rules linter Apply operator-observability rules linter which ensures that kubevirt alerts and recording rules definitions are following the monitoring best practices. Signed-off-by: assafad <aadmi@redhat.com> * Apply monitoringlinter Apply monitoringlinter, which is designed to ensure that in Kubernetes operator projects, monitoring-related practices are implemented within the pkg/monitoring directory using operator-observability methods. Signed-off-by: assafad <aadmi@redhat.com> --------- Signed-off-by: assafad <aadmi@redhat.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package rules | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/machadovilaca/operator-observability/pkg/testutil" | ||
) | ||
|
||
func TestRules(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Rules Suite") | ||
} | ||
|
||
var _ = Describe("Rules Validation", func() { | ||
var linter *testutil.Linter | ||
|
||
BeforeEach(func() { | ||
Expect(SetupRules()).To(Succeed()) | ||
linter = testutil.New() | ||
}) | ||
|
||
It("Should validate alerts", func() { | ||
linter.AddCustomAlertValidations( | ||
testutil.ValidateAlertNameLength, | ||
testutil.ValidateAlertRunbookURLAnnotation, | ||
testutil.ValidateAlertHealthImpactLabel, | ||
testutil.ValidateAlertPartOfAndComponentLabels) | ||
|
||
alerts := ListAlerts() | ||
problems := linter.LintAlerts(alerts) | ||
Expect(problems).To(BeEmpty()) | ||
}) | ||
|
||
It("Should validate recording rules", func() { | ||
recordingRules := ListRecordingRules() | ||
problems := linter.LintRecordingRules(recordingRules) | ||
Expect(problems).To(BeEmpty()) | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.