I'm trying to run some tests over an alert I've added but I haven't been able to "mock" of defining the value of the function "time". Do you know how to do it?
I'm currently doing this:
- interval: 5m
input_series:
- series: 'probe_ssl_earliest_cert_expiry{instance="instance1", job="job-1"}'
values: '17000000 35000000 5000000 10000000'
- series: 'time'
values: '100000000 20000000 25000000 30000000'
alert_rule_test:
- alertname: CertificateExpiry
eval_time: 0m
exp_alerts:
- exp_labels:
severity: warning
instance: instance1
exp_annotations:
summary: "Certificate in instance1 is due to expiry in less than 30 days"
description: "Certificate in instance1 is due to expiry in less than 30 days."
and the alert is defined as follow:
- alert: CertificateExpiry
expr: probe_ssl_earliest_cert_expiry - time() < 86400 * 30
labels:
severity: warning
annotations:
summary: "Certificate in {{ $labels.instance }} is due to expiry in less than 30 days"
description: "Certificate in {{ $labels.instance }} is due to expiry in less than 30 days."
Do you know how can I define the values of time in the same way I do it with the series?
Thanks in advance,
Emmanuel