mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmalert: silence golagci-lint at TestAlertingRule_Template
Add a break if gotAlert is nil This removes the following golangci-lint warning: app/vmalert/alerting_test.go:868:8: SA5011(related information): this check suggests that the pointer can be nil (staticcheck) if gotAlert == nil { ^
This commit is contained in:
parent
a79e53d82a
commit
4f6dc25c71
1 changed files with 2 additions and 2 deletions
|
@ -866,8 +866,8 @@ func TestAlertingRule_Template(t *testing.T) {
|
||||||
for hash, expAlert := range tc.expAlerts {
|
for hash, expAlert := range tc.expAlerts {
|
||||||
gotAlert := tc.rule.alerts[hash]
|
gotAlert := tc.rule.alerts[hash]
|
||||||
if gotAlert == nil {
|
if gotAlert == nil {
|
||||||
t.Fatalf("alert %d is missing; labels: %v; annotations: %v",
|
t.Fatalf("alert %d is missing; labels: %v; annotations: %v", hash, expAlert.Labels, expAlert.Annotations)
|
||||||
hash, expAlert.Labels, expAlert.Annotations)
|
break
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(expAlert.Annotations, gotAlert.Annotations) {
|
if !reflect.DeepEqual(expAlert.Annotations, gotAlert.Annotations) {
|
||||||
t.Fatalf("expected to have annotations %#v; got %#v", expAlert.Annotations, gotAlert.Annotations)
|
t.Fatalf("expected to have annotations %#v; got %#v", expAlert.Annotations, gotAlert.Annotations)
|
||||||
|
|
Loading…
Reference in a new issue