http response prometheus /api/v1/status/flags 200 {"status":"success","data":{"storage.tsdb.retention.time": "1d"}}
http response prometheus /api/v1/metadata 200 {"status":"success","data":{}}
http response prometheus /api/v1/status/config 200 {"status":"success","data":{"yaml":"global:\n  scrape_interval: 1m\n"}}
http response prometheus /api/v1/query_range 200 {"status":"success","data":{"resultType":"matrix","result":[]}}
http response prometheus /api/v1/query 200 {"status":"success","data":{"resultType":"vector","result":[]}}
http start prometheus 127.0.0.1:7171

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

cp ../src/.pint.hcl .
cp ../src/v1.yaml rules.yaml
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 pr

cp ../src/v2.yaml rules.yaml
exec git commit -am 'v2'

exec git mv rules.yaml renamed.yaml
exec git commit -am 'v3'

! exec pint --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
level=INFO msg="Configured new Prometheus server" name=prom uris=1 uptime=up tags=[] include=["^.*.yaml$"] exclude=[]
level=INFO msg="Checking Prometheus rules" entries=1 workers=10 online=true
level=WARN msg="No results for Prometheus uptime metric, you might have set uptime config option to a missing metric, please check your config" name=prom metric=up
level=WARN msg="Using dummy Prometheus uptime metric results with no gaps" name=prom metric=up
level=INFO msg="Problems found" Bug=1
Bug: query on nonexistent series (promql/series)
  ---> renamed.yaml:2 -> `rule1`
2 |   expr: sum(foo)
                ^^^ `prom` Prometheus server at http://127.0.0.1:7171 didn't have any series for `foo` metric in the last 1w.

level=ERROR msg="Execution completed with error(s)" err="problems found"
-- src/v1.yaml --
- record: rule1
  # pint disable promql/series
  expr: sum(foo)
-- src/v2.yaml --
- record: rule1
  expr: sum(foo)
-- src/.pint.hcl --
ci {
  baseBranch = "main"
}
parser {
  relaxed = [".*"]
}
prometheus "prom" {
  uri      = "http://127.0.0.1:7171"
  failover = []
  timeout  = "5s"
  required = true
  include  = [".*.yaml"]
}
