forked from cloudflare/pint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't fail to parse YAML on template errors
- Loading branch information
Showing
4 changed files
with
54 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
pint.error --no-color lint rules | ||
! stdout . | ||
cmp stderr stderr.txt | ||
|
||
-- stderr.txt -- | ||
level=info msg="File parsed" path=rules/strict.yml rules=5 | ||
rules/strict.yml:4: incomplete rule, no alert or record key (yaml/parse) | ||
- expr: MissingAlertOrRecord | ||
|
||
rules/strict.yml:7: syntax error: no expression found in input (promql/syntax) | ||
expr: | ||
|
||
rules/strict.yml:10: syntax error: unknown function with name "sumz" (promql/syntax) | ||
expr: sumz(0) | ||
|
||
rules/strict.yml:15: template parse error: function "bogus" not defined (alerts/template) | ||
dashboard: '{{ bogus }}' | ||
|
||
rules/strict.yml:20: template parse error: function "bogus" not defined (alerts/template) | ||
dashboard: '{{ bogus }}' | ||
|
||
level=info msg="Problems found" Fatal=5 | ||
level=fatal msg="Fatal error" error="problems found" | ||
-- rules/strict.yml -- | ||
groups: | ||
- name: foo | ||
rules: | ||
- expr: MissingAlertOrRecord | ||
|
||
- alert: MissingExpr | ||
expr: | ||
|
||
- record: BadPromQL | ||
expr: sumz(0) | ||
|
||
- alert: IgnoreTemplateErrors | ||
expr: up == 0 | ||
annotations: | ||
dashboard: '{{ bogus }}' | ||
|
||
- alert: IgnoreTemplateErrors | ||
expr: up == 0 | ||
labels: | ||
dashboard: '{{ bogus }}' |
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