diff --git a/tests/apiserver-availability-test.yaml b/tests/apiserver-availability-test.yaml new file mode 100644 index 000000000..6bb36267c --- /dev/null +++ b/tests/apiserver-availability-test.yaml @@ -0,0 +1,23 @@ +rule_files: +- ../prometheus_alerts.yaml +- ../prometheus_rules.yaml + +evaluation_interval: 1m + +tests: +- interval: 1m + input_series: + # 100 requests in the overall interval, 99 successful and 1 error + - series: 'apiserver_request_total{job="kube-apiserver",verb="GET",code="200"}' + values: '0 10 20 50 90 99' + - series: 'apiserver_request_total{job="kube-apiserver",verb="GET",code="500"}' + values: '0 0 0 1 1 1' + + promql_expr_test: + - eval_time: 5m + expr: code_verb:apiserver_request_total:increase1h{verb="GET"} + exp_samples: + - labels: '{__name__="code_verb:apiserver_request_total:increase1h", code="200", verb="GET"}' + value: 99.0 + - labels: '{__name__="code_verb:apiserver_request_total:increase1h", code="500", verb="GET"}' + value: 1.0