You haven't included your alerting rules file.

I also note you provide only one value for the mysql_up series. You might 
want something like "0x15" there. See:
https://prometheus.io/docs/prometheus/latest/configuration/unit_testing_rules/#series

On Tuesday, 19 September 2023 at 20:49:39 UTC+1 radhamani...@gmail.com 
wrote:

> Hi,
> I have below prometheus unit test 
>
> I tried a lot of manipulations on input_series. But it is always throwing 
> failure. 
> It only evaluates the first value in the input series.
>
>
> Unit Testing:  tests/infra_db_alerts-tests.yml
>   FAILED:
>     alertname: MySQLReplicationDown, time: 10m, 
>         exp:[
>             0:
>               Labels:{alert_owner="alerts-infra", 
> alertname="MySQLReplicationDown", severity="High"}
>               Annotations:{description="MySQL replication is broken. \n"}
>             ], 
>         got:[]
>
> rule_files:
> - ../rules/db_alerts.yml
>
> tests:
> # MySQL Alert Tests
> - input_series:
> - series: mysql_up
> values: 0
> - series: mysql_global_variables_innodb_replication_delay
> values: '1 1 1 1 1 0 0 0 0 -1 -1 -1 -1 -1 -1'
>
> alert_rule_test:
> - alertname: MySQLReplicationLag
> eval_time: 5m
> exp_alerts:
> - exp_labels:
> severity: High
> alert_owner: alerts-infra
> exp_annotations:
> description: "There is a MySQL replication delay. \n"
>
> - alertname: MySQLReplicationDown
> eval_time: 10m
> exp_alerts:
> - exp_labels:
> severity: High
> alert_owner: alerts-infra
> exp_annotations:
> description: "MySQL replication is broken. \n"
>
>

-- 
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/428bd6c2-f15c-4705-a21a-46ef92b6c2e2n%40googlegroups.com.

Reply via email to