mkdir testrepo
cd testrepo
exec git init --initial-branch=main .

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 v1
cp ../src/a.yml a.yml
exec git add a.yml
exec git commit -am 'v1'

exec git checkout -b v2
cp ../src/b.yml b.yml
exec git add b.yml
exec git commit -am 'v2'

exec git checkout -b v3
exec git rm a.yml
exec git commit -am 'v3'

pint.error --no-color ci -t
! 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
level=INFO msg="Problems found" Fatal=1 Warning=1
##teamcity[testSuiteStarted name='promql/syntax']
##teamcity[testSuiteStarted name='Fatal']
##teamcity[testStarted name='b.yml:2']
##teamcity[testFailed name='b.yml:2' message='' details='Prometheus failed to parse the query with this PromQL error: unexpected identifier "bi".']
##teamcity[testFinished name='b.yml:2']
##teamcity[testSuiteFinished name='Fatal']
##teamcity[testSuiteFinished name='promql/syntax']
##teamcity[testSuiteStarted name='alerts/comparison']
##teamcity[testSuiteStarted name='Warning']
##teamcity[testStarted name='b.yml:4']
##teamcity[testStdErr name='b.yml:4' out='Alert query doesn|'t have any condition, it will always fire if the metric exists.']
##teamcity[testFinished name='b.yml:4']
##teamcity[testSuiteFinished name='Warning']
##teamcity[testSuiteFinished name='alerts/comparison']
level=ERROR msg="Fatal error" err="problems found"
-- src/a.yml --
- record: rule1
  expr: sum(foo) bi()
-- src/b.yml --
- record: rule1
  expr: sum(foo) bi()
- alert: rule2
  expr: sum(foo) 
-- src/.pint.hcl --
ci {
  baseBranch = "main"
}
parser {
  relaxed = [".*"]
}
