Skip to content

Commit

Permalink
Update check_alert_tests script to use ALERT_SEVERITY
Browse files Browse the repository at this point in the history
  • Loading branch information
biswassri committed Nov 14, 2024
1 parent 1f095f8 commit bcc6a96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions tests/prometheus_unit_tests/scripts/check_alert_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,7 +22,7 @@ done < <(
| .alert_rule_test[]
| .exp_alerts[]
| .exp_labels
| select(.severity == "critical")
| select(.severity == "'${ALERT_SEVERITY}'")
| .alertname' "$alert"
done
)
Expand Down

0 comments on commit bcc6a96

Please sign in to comment.