Skip to content

Commit

Permalink
Fix unit tests&add tests for no/low/high alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
JustHumanz committed Dec 13, 2024
1 parent 7610c8c commit 90cb5c5
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions roles/kube_prometheus_stack/files/jsonnet/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,50 @@ tests:
input_series:
- series: 'mysql_up{instance="percona-xtradb-pxc-0", job="pxc"}'
values: '1'
input_series:
- series: 'mysql_up{instance="percona-xtradb-pxc-1", job="pxc"}'
values: '1'
- series: 'mysql_up{instance="percona-xtradb-pxc-3", job="pxc"}'
values: '0'
alert_rule_test:
- eval_time: 1m
alertname: MysqlClusterDown
exp_alerts:
- exp_labels:
severity: P5
exp_annotations:
summary: "1 percona-xtradb replication down"

- interval: 1m
input_series:
- series: 'mysql_up{instance="percona-xtradb-pxc-0", job="pxc"}'
values: '1'
- series: 'mysql_up{instance="percona-xtradb-pxc-1", job="pxc"}'
values: '0'
- series: 'mysql_up{instance="percona-xtradb-pxc-3", job="pxc"}'
values: '0'
alert_rule_test:
- eval_time: 5m
- eval_time: 1m
alertname: MysqlClusterDown
exp_alerts:
- exp_labels:
severity: P3
exp_annotations:
summary: 'Only 33% percona-xtradb cluster are online'
description: "percona-xtradb cluster less than minimum replication, please check with kubectl get pods -n openstack -l app.kubernetes.io/component=pxc"
- exp_labels:
severity: P5
exp_annotations:
summary: "2 percona-xtradb replication down"

- interval: 1m
input_series:
- series: 'mysql_up{instance="percona-xtradb-pxc-0", job="pxc"}'
values: '1'
- series: 'mysql_up{instance="percona-xtradb-pxc-1", job="pxc"}'
values: '1'
- series: 'mysql_up{instance="percona-xtradb-pxc-3", job="pxc"}'
values: '1'
alert_rule_test:
- eval_time: 1m
alertname: MysqlClusterDown
exp_alerts: []
exp_alerts: []

0 comments on commit 90cb5c5

Please sign in to comment.