-
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.
Add a test for pint ci with no changes
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
http response bitbucket /rest/insights/1.0/projects/prometheus/repos/rules/commits/.*/reports/pint 200 OK | ||
http response bitbucket /rest/api/1.0/projects/prometheus/repos/rules/commits/.*/pull-requests 200 {} | ||
http start bitbucket 127.0.0.1:6188 | ||
|
||
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 GIT_AUTHOR_EMAIL=pint@example.com | ||
env GIT_COMMITTER_NAME=pint | ||
env GIT_COMMITTER_EMAIL=pint@example.com | ||
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' | ||
|
||
env BITBUCKET_AUTH_TOKEN="12345" | ||
exec pint -l debug --no-color ci | ||
! stdout . | ||
stderr '{"value":2,"title":"Number of rules parsed","type":"NUMBER"}' | ||
stderr '{"value":2,"title":"Number of rules checked","type":"NUMBER"}' | ||
stderr '{"value":0,"title":"Number of problems found","type":"NUMBER"}' | ||
stderr '{"value":0,"title":"Number of offline checks","type":"NUMBER"}' | ||
stderr '{"value":0,"title":"Number of online checks","type":"NUMBER"}' | ||
stderr '{"value":0,"title":"Checks duration","type":"DURATION"}' | ||
|
||
-- src/rules.yml -- | ||
- alert: alert1 | ||
expr: up == 0 | ||
for: 5m | ||
- alert: alert2 | ||
expr: up == 0 | ||
for: 5m | ||
|
||
-- src/.pint.hcl -- | ||
parser { | ||
relaxed = [".*"] | ||
} | ||
ci { | ||
baseBranch = "main" | ||
} | ||
repository { | ||
bitbucket { | ||
uri = "http://127.0.0.1:6188" | ||
project = "prometheus" | ||
repository = "rules" | ||
} | ||
} | ||
prometheus "prom" { | ||
uri = "http://127.0.0.1:2188" | ||
timeout = "5s" | ||
required = true | ||
} | ||
rule { | ||
match { | ||
kind = "alerting" | ||
} | ||
alerts { | ||
range = "1d" | ||
step = "1m" | ||
resolve = "5m" | ||
} | ||
} |