-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
439 additions
and
166 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,44 @@ | ||
pint.ok -l debug --no-color -e promql/aggregate lint rules | ||
! stdout . | ||
cmp stderr stderr.txt | ||
|
||
-- stderr.txt -- | ||
level=INFO msg="Loading configuration file" path=.pint.hcl | ||
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl | ||
level=INFO msg="Finding all rules to check" paths=["rules"] | ||
level=DEBUG msg="File parsed" path=rules/0001.yml rules=3 | ||
level=DEBUG msg="Glob finder completed" count=3 | ||
level=DEBUG msg="Generated all Prometheus servers" count=0 | ||
level=DEBUG msg="Found alerting rule" path=rules/0001.yml alert=default-for lines=1-3 | ||
level=DEBUG msg="Configured checks for rule" enabled=[] path=rules/0001.yml rule=default-for | ||
level=DEBUG msg="Found recording rule" path=rules/0001.yml record=sum:job lines=5-6 | ||
level=DEBUG msg="Configured checks for rule" enabled=["promql/aggregate(job:true)"] path=rules/0001.yml rule=sum:job | ||
level=DEBUG msg="Found alerting rule" path=rules/0001.yml alert=no-comparison lines=8-9 | ||
level=DEBUG msg="Configured checks for rule" enabled=[] path=rules/0001.yml rule=no-comparison | ||
rules/0001.yml:6 Warning: `job` label is required and should be preserved when aggregating `^.+$` rules, use `by(job, ...)`. (promql/aggregate) | ||
6 | expr: sum(foo) | ||
|
||
level=INFO msg="Problems found" Warning=1 | ||
-- rules/0001.yml -- | ||
- alert: default-for | ||
expr: foo > 1 | ||
for: 0m | ||
|
||
- record: sum:job | ||
expr: sum(foo) | ||
|
||
- alert: no-comparison | ||
expr: foo | ||
|
||
-- .pint.hcl -- | ||
parser { | ||
relaxed = [".*"] | ||
} | ||
rule { | ||
match { | ||
kind = "recording" | ||
} | ||
aggregate ".+" { | ||
keep = [ "job" ] | ||
} | ||
} |
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,40 @@ | ||
mkdir testrepo | ||
cd testrepo | ||
exec git init --initial-branch=main . | ||
|
||
cp ../src/rules.yml rules.yml | ||
cp ../src/.pint.hcl . | ||
env GIT_AUTHOR_NAME=pint | ||
env [email protected] | ||
env GIT_COMMITTER_NAME=pint | ||
env [email protected] | ||
exec git add . | ||
exec git commit -am 'import rules and config' | ||
|
||
exec git checkout -b v2 | ||
exec touch .keep | ||
exec git add .keep | ||
exec git commit -am 'v2' | ||
|
||
pint.ok --no-color ci | ||
! stdout . | ||
cmp stderr ../stderr.txt | ||
|
||
-- stderr.txt -- | ||
level=INFO msg="Loading configuration file" path=.pint.hcl | ||
level=INFO msg="Finding all rules to check on current git branch" base=main | ||
-- src/rules.yml -- | ||
# pint ignore/file | ||
- record: rule1 | ||
expr: sum(foo) by(job) | ||
- record: rule2 | ||
expr: sum(foo) | ||
|
||
-- src/.pint.hcl -- | ||
ci { | ||
baseBranch = "main" | ||
} | ||
parser { | ||
relaxed = [".*"] | ||
include = ["rules.yml"] | ||
} |
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
Oops, something went wrong.