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

Add operator-observability rules unit test #1776

Merged
merged 2 commits into from Mar 28, 2024

Conversation

assafad
Copy link
Contributor

@assafad assafad commented Mar 28, 2024

What this PR does / why we need it:
Add operator-observability rules unit test, which ensures that alerts and recording rules definitions are following the monitoring best practices, e.g. alerts have all the required annotations and labels with expected values, recording rules have expressions, etc.

Fixes https://issues.redhat.com/browse/CNV-36763
Other PRs references: kubevirt/hyperconverged-cluster-operator#2827, kubevirt/kubevirt#11454

/cc @machadovilaca, @oshoval

Release note:

None

@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Mar 28, 2024
pkg/monitoring/rules/rules_test.go Outdated Show resolved Hide resolved
@machadovilaca
Copy link
Member

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 28, 2024
Copy link
Collaborator

@oshoval oshoval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please consider splitting to commits, one that does the vendoring and one for the code changes, here it is easy to review, but when it isn't it is much better.

Do we need all the PR referenced ? it is nice to have, but maybe lets trim the list please to the most important ones?

@@ -0,0 +1,13 @@
package rules
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use package rules_test (both files)
all the functions that you are testing are already external so it is easy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to import rules package for using some functions, but done.

Vendor grafana/regexp package, as it's needed for the alerts and
recording rules testing

Signed-off-by: assafad <aadmi@redhat.com>
Add rules unit test, which ensures that alerts and recording rules
definitions are following conventions.

Signed-off-by: assafad <aadmi@redhat.com>
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 28, 2024
Copy link

sonarcloud bot commented Mar 28, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@assafad
Copy link
Contributor Author

assafad commented Mar 28, 2024

Thanks

Please consider splitting to commits, one that does the vendoring and one for the code changes, here it is easy to review, but when it isn't it is much better.

Do we need all the PR referenced ? it is nice to have, but maybe lets trim the list please to the most important ones?

@oshoval Done.

@oshoval
Copy link
Collaborator

oshoval commented Mar 28, 2024

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 28, 2024
@kubevirt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: oshoval

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 28, 2024
@kubevirt-bot kubevirt-bot merged commit 0b46ce6 into kubevirt:main Mar 28, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants