Hi, I need help in this alert test. This is the alert rule I have,
- alert: ServiceMemoryUsage90Percent expr: sum(container_memory_usage_bytes{job="cadvisor",container_label_io_rancher_stack_name!="", image=~"rancher.*"}) by (container_label_io_rancher_stack_name, instance, dns_name) /1024/1024/1024 *100 > 90 for: 5m labels: severity: Critical alert_owner: alerts-infra annotations: description: "Service memory has been at over 90% for 1 minute. Service: {{ $labels.container_label_io_rancher_stack_name }}, DnsName: {{ $labels.dns_name }}. \n" I am trying to write a test for this, tests: # Infra Alert Tests - input_series: - series: 'container_memory_usage_bytes{job="cadvisor",container_label_io_rancher_stack_name="network-service",image="rancher.test"}' values: '0 100000000 0 100000000 100000000' alert_rule_test: - alertname: ServiceMemoryUsage90Percent # eval_time: 5m exp_alerts: - exp_labels: alertname: ServiceMemoryUsage90Percent severity: Critical alert_owner: alerts-infra exp_annotations: description: "Service memory has been at over 90% for 1 minute. Service: (), DnsName: ()." But I am always getting , *Unit Testing: tests/infra_db_alerts-tests.yml FAILED: alertname: ServiceMemoryUsage90Percent, time: 0s, exp:[ 0: Labels:{alert_owner="alerts-infra", alertname="ServiceMemoryUsage90Percent", severity="Critical"} Annotations:{description="Service memory has been at over 90% for 1 minute. Service: (), DnsName: ()."} ], got:[]* I tried many options in alert rule testing. But nothing helped. Any help on this please? not sure why I am getting got as empty. And always alert is getting triggered even if I keep input series value as 0. -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/89ed302c-b492-4f6d-8024-2238c5d65953n%40googlegroups.com.