mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-01 14:47:38 +00:00
da60a68d09
vmalert: support unit tests See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2945 --------- Signed-off-by: hagen1778 <roman@victoriametrics.com> Co-authored-by: hagen1778 <roman@victoriametrics.com>
41 lines
881 B
YAML
41 lines
881 B
YAML
rule_files:
|
|
- rules.yaml
|
|
|
|
tests:
|
|
- interval: 1m
|
|
name: "Failing test"
|
|
input_series:
|
|
- series: test
|
|
values: "0"
|
|
|
|
metricsql_expr_test:
|
|
- expr: test
|
|
eval_time: 0m
|
|
exp_samples:
|
|
- value: 0
|
|
labels: test
|
|
|
|
# will failed cause there is no "Test" group and rule defined
|
|
alert_rule_test:
|
|
- eval_time: 0m
|
|
groupname: Test
|
|
alertname: Test
|
|
exp_alerts:
|
|
- exp_labels: {}
|
|
|
|
- interval: 1m
|
|
name: Failing alert test
|
|
input_series:
|
|
- series: 'up{job="test"}'
|
|
values: 0x10
|
|
|
|
alert_rule_test:
|
|
# will failed cause rule is firing
|
|
- eval_time: 5m
|
|
groupname: group1
|
|
alertname: InstanceDown
|
|
exp_alerts: []
|
|
# will failed cause missing groupname
|
|
- eval_time: 5m
|
|
alertname: AlwaysFiring
|
|
exp_alerts: []
|