CICD-352 · Prometheus rule testing
Encyclopedia · Observability and SRE pipelines · All snippets
Previous · CICD-351 · Next · CICD-353
1. Where it fits
- Placement CI run step.
- Prerequisites staging metrics stack, provisioned endpoints and read-only CI identity except explicitly approved writes.
- Platforms local-linux, github-actions, gitea-actions.
2. Copy the snippet
bash
promtool test rules monitoring/rule-tests.yml3. How it works
The tool validates the Prometheus configuration or evaluates rule expectations against known test series. The shell predicate makes the expected state explicit and returns a nonzero status when it is not satisfied.
4. Verify the result
Use synthetic time series with at least one firing and one non-firing case. An unexpected label fails the test.
Validation syntax-validated (Bash parse). Status definitions.