Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply operator-observability rules linter
Apply operator-observability rules linter which ensures that kubevirt alerts and recording rules are following the monitoring best practices, e.g. have all the required annotations and labels with expected values. Signed-off-by: assafad <aadmi@redhat.com>
- Loading branch information
Showing
20 changed files
with
3,165 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package rules | ||
|
||
import ( | ||
"testing" | ||
|
||
"kubevirt.io/client-go/testutils" | ||
) | ||
|
||
func TestRules(t *testing.T) { | ||
testutils.KubeVirtTestSuiteSetup(t) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package rules | ||
|
||
import ( | ||
"github.com/machadovilaca/operator-observability/pkg/testutil" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Rules Validation", func() { | ||
var linter *testutil.Linter | ||
|
||
BeforeEach(func() { | ||
err := SetupRules("") | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
linter = testutil.New() | ||
}) | ||
|
||
It("Should validate alerts", func() { | ||
linter.AddCustomAlertValidations(testutil.ValidateAlertNameLength, testutil.ValidateAlertRunbookURLAnnotation, | ||
testutil.ValidateAlertHealthImpactLabel, testutil.ValidateAlertPartOfAndComponentLabels) | ||
|
||
alerts := ListAlerts() | ||
for _, alert := range alerts { | ||
problems := linter.LintAlert(&alert) | ||
Expect(problems).To(BeEmpty()) | ||
} | ||
}) | ||
|
||
It("Should validate recording rules", func() { | ||
recordingRules := ListRecordingRules() | ||
for _, rr := range recordingRules { | ||
problems := linter.LintRecordingRule(&rr) | ||
Expect(problems).To(BeEmpty()) | ||
} | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.