Type object
File match *.prometheus.tests.yml *.prometheus.tests.yaml *.prometheus.test.yml *.prometheus.test.yaml
Schema URL https://catalog.lintel.tools/schemas/schemastore/prometheus-rules-test-json/latest.json
Source https://www.schemastore.org/prometheus.rules.test.json

Validate with Lintel

npx @lintel/lintel check
Type: object

Properties

evaluation_interval string | null

The evaluation interval for the tests. [duration] format.

Default: "1m"
group_eval_order array | null

The order in which group names are listed below will be the order of evaluation of rule groups (at a given evaluation time).

rule_files string[]

List of rule files to consider for testing. Globs are supported.

tests test_group[]

Definitions

alert object
exp_labels object | null required
exp_annotations object | null
alert_test_case object
alertname string required

Name of the alert to be tested.

eval_time string | null required
minLength=1pattern=^([0-9]+y)?([0-9]+w)?([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)?([0-9]+ms)?$
exp_alerts alert[]

List of expected alerts firing under the given alertname at the given evaluation time

duration string | null
label_value string
labels object | null
promql_test_case object
eval_time string | null required
minLength=1pattern=^([0-9]+y)?([0-9]+w)?([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)?([0-9]+ms)?$
expr string | integer required

PromQL expression to evaluate

exp_samples sample[]

Expected samples at the given evaluation time.

sample object
labels string required

Labels of the sample in the usual series notation '{

value number required

Expected value of the PromQL expression.

series object
series string required

This follows the usual series notation '{

values string required

This uses expanded notation to project time series. There are also the special _ and stale values to indicate missing or stale samples

test_group object
input_series series[] required

A list of time series

interval string | null required
minLength=1pattern=^([0-9]+y)?([0-9]+w)?([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)?([0-9]+ms)?$
alert_rule_test alert_test_case[]

Unit tests for alerting rules. We only consider the alerting rules from the input files.

external_labels object | null
external_url string

External URL accessible to the alert template. Usually set using --web.external-url.

name string

Name of the test group

promql_expr_test promql_test_case[]

Unit tests for PromQL expressions