! exec pint --no-color -d 'promql/.*' -d alerts/count lint rules
! stdout .
cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=INFO msg="Configured new Prometheus server" name=prom uris=1 uptime=up tags=[] include=[] exclude=[]
level=INFO msg="Checking Prometheus rules" entries=8 workers=10 online=true
level=ERROR msg="Query returned an error" err="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" uri=http://127.0.0.1:7108 query=/api/v1/status/config
level=ERROR msg="Query returned an error" err="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" uri=http://127.0.0.1:7108 query=/api/v1/status/config
level=ERROR msg="Query returned an error" err="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" uri=http://127.0.0.1:7108 query=/api/v1/status/config
level=ERROR msg="Query returned an error" err="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" uri=http://127.0.0.1:7108 query=/api/v1/status/config
level=ERROR msg="Query returned an error" err="failed to query Prometheus config: Get \"http://127.0.0.1:7108/api/v1/status/config\": dial tcp 127.0.0.1:7108: connect: connection refused" uri=http://127.0.0.1:7108 query=/api/v1/status/config
Bug: duplicated recording rule (rule/duplicate)
  ---> rules/0001.yml:1-2 -> `colo:duplicate`
1 | - record: "colo:duplicate"
               ^^^^^^^^^^^^^^ Duplicated rule, identical rule found at rules/0002.yml:1.

Bug: unable to run checks (labels/conflict)
  ---> rules/0001.yml:5-8 -> `colo:labels:mismatch` [+4 duplicates]
5 | - record: "colo:labels:mismatch"
               ^^^^^^^^^^^^^^^^^^^^ Couldn't run some online checks due to `prom` Prometheus server at http://127.0.0.1:7108 connection error: `connection refused`.

Bug: duplicated recording rule (rule/duplicate)
  ---> rules/0001.yml:9-12 -> `colo:labels:equal`
9 | - record: "colo:labels:equal"
               ^^^^^^^^^^^^^^^^^ Duplicated rule, identical rule found at rules/0002.yml:11.

level=INFO msg="Some problems are duplicated between rules and all the duplicates were hidden, pass `--show-duplicates` to see them" total=7 duplicates=4 shown=3
level=INFO msg="Problems found" Bug=7
level=ERROR msg="Execution completed with error(s)" err="found 7 problem(s) with severity Bug or higher"
-- rules/0001.yml --
- record: "colo:duplicate"
  expr: sum(foo) without(job)
- record: "colo:labels:empty"
  expr: sum(foo) without(job)
- record: "colo:labels:mismatch"
  expr: sum(foo) without(job)
  labels:
    file: a
- record: "colo:labels:equal"
  expr: sum(foo) without(job)
  labels:
    same: yes

-- rules/0002.yml --
- record: "colo:duplicate"
  expr: sum(foo) without(job)
- record: "colo:labels:empty"
  expr: sum(foo) without(job)
  labels:
    empty: nope
- record: "colo:labels:mismatch"
  expr: sum(foo) without(job)
  labels:
    file: b
- record: "colo:labels:equal"
  expr: sum(foo) without(job)
  labels:
    same: yes

# pint file/disable rule/duplicate

-- .pint.hcl --
prometheus "prom" {
  uri      = "http://127.0.0.1:7108"
  failover = []
  timeout  = "5s"
  required = true
}
parser {
  relaxed = [".*"]
}
