mirror of
https://github.com/prometheus/prometheus
synced 2024-12-27 17:13:22 +00:00
Merge pull request #5774 from simonpasquier/fix-panic-promtool
cmd/promtool: fix panic with empty exp_labels
This commit is contained in:
commit
a08db6119a
@ -286,6 +286,9 @@ func (tg *testGroup) test(mint, maxt time.Time, evalInterval time.Duration, grou
|
||||
for _, a := range testcase.ExpAlerts {
|
||||
// User gives only the labels from alerting rule, which doesn't
|
||||
// include this label (added by Prometheus during Eval).
|
||||
if a.ExpLabels == nil {
|
||||
a.ExpLabels = make(map[string]string)
|
||||
}
|
||||
a.ExpLabels[labels.AlertName] = testcase.Alertname
|
||||
|
||||
expAlerts = append(expAlerts, labelAndAnnotation{
|
||||
|
Loading…
Reference in New Issue
Block a user