diff --git a/README.md b/README.md index aab41f242a1..8743cd80781 100644 --- a/README.md +++ b/README.md @@ -418,7 +418,7 @@ To check for alerts that don't have unit tests, run the below command: make check-prometheus-alert-unit-tests ``` -To add a new unit test, add the alert YAML file and the corresponding rule files to the [extract_alerts](tests/scripts/extract_alerts.sh) script. +To add a new unit test, add the alert YAML file and the corresponding rule files to the [extract_alerts](tests/prometheus_unit_tests/scripts/extract_alerts.sh) script. ### API Overview diff --git a/tests/prometheus_unit_tests/scripts/check_alert_tests.sh b/tests/prometheus_unit_tests/scripts/check_alert_tests.sh index 291e6f87623..0b46e837c4a 100755 --- a/tests/prometheus_unit_tests/scripts/check_alert_tests.sh +++ b/tests/prometheus_unit_tests/scripts/check_alert_tests.sh @@ -10,7 +10,7 @@ while IFS= read -r ALERT; do done < <(yq -N e '.data[] | from_yaml | .groups[].rules[] - | select(.alert != "DeadManSnitch" and .labels.severity == "critical") + | select(.alert != "DeadManSnitch" and .labels.severity == "'${ALERT_SEVERITY}'") | .alert' "${PROMETHEUS_CONFIG_YAML}") # Collect all alerts from the unit test files @@ -22,7 +22,7 @@ done < <( | .alert_rule_test[] | .exp_alerts[] | .exp_labels - | select(.severity == "critical") + | select(.severity == "'${ALERT_SEVERITY}'") | .alertname' "$alert" done )