Chore: Enable whitespace linter (#25903)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -80,7 +80,6 @@ func TestWhenAlertManagerShouldNotify(t *testing.T) {
|
||||
//nolint:goconst
|
||||
func TestAlertmanagerNotifier(t *testing.T) {
|
||||
Convey("Alertmanager notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -57,7 +57,6 @@ func init() {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func newDingDingNotifier(model *models.AlertNotification) (alerting.Notifier, error) {
|
||||
@@ -113,7 +112,6 @@ func (dd *DingDingNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
}
|
||||
|
||||
func (dd *DingDingNotifier) genBody(evalContext *alerting.EvalContext, messageURL string) ([]byte, error) {
|
||||
|
||||
q := url.Values{
|
||||
"pc_slide": {"false"},
|
||||
"url": {messageURL},
|
||||
|
||||
@@ -24,7 +24,6 @@ func TestDingDingNotifier(t *testing.T) {
|
||||
|
||||
_, err := newDingDingNotifier(model)
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
})
|
||||
Convey("settings should trigger incident", func() {
|
||||
json := `{ "url": "https://www.google.com" }`
|
||||
|
||||
@@ -105,7 +105,6 @@ func (dn *DiscordNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
fields := make([]map[string]interface{}, 0)
|
||||
|
||||
for _, evt := range evalContext.EvalMatches {
|
||||
|
||||
fields = append(fields, map[string]interface{}{
|
||||
"name": evt.Metric,
|
||||
"value": evt.Value.FullString(),
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func TestDiscordNotifier(t *testing.T) {
|
||||
Convey("Telegram notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func TestEmailNotifier(t *testing.T) {
|
||||
Convey("Email notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func TestGoogleChatNotifier(t *testing.T) {
|
||||
Convey("Google Hangouts Chat notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -64,7 +64,6 @@ func init() {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
//nolint:goconst
|
||||
func TestHipChatNotifier(t *testing.T) {
|
||||
Convey("HipChat notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func TestKafkaNotifier(t *testing.T) {
|
||||
Convey("Kafka notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -22,7 +22,6 @@ func TestLineNotifier(t *testing.T) {
|
||||
|
||||
_, err := NewLINENotifier(model)
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
})
|
||||
Convey("settings should trigger incident", func() {
|
||||
json := `
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
|
||||
func TestOpsGenieNotifier(t *testing.T) {
|
||||
Convey("OpsGenie notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -134,7 +134,6 @@ type PagerdutyNotifier struct {
|
||||
|
||||
// buildEventPayload is responsible for building the event payload body for sending to Pagerduty v2 API
|
||||
func (pn *PagerdutyNotifier) buildEventPayload(evalContext *alerting.EvalContext) ([]byte, error) {
|
||||
|
||||
eventType := "trigger"
|
||||
if evalContext.Rule.State == models.AlertStateOK {
|
||||
eventType = "resolve"
|
||||
@@ -241,7 +240,6 @@ func (pn *PagerdutyNotifier) buildEventPayload(evalContext *alerting.EvalContext
|
||||
|
||||
// Notify sends an alert notification to PagerDuty
|
||||
func (pn *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
|
||||
if evalContext.Rule.State == models.AlertStateOK && !pn.AutoResolve {
|
||||
pn.log.Info("Not sending a trigger to Pagerduty", "state", evalContext.Rule.State, "auto resolve", pn.AutoResolve)
|
||||
return nil
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
|
||||
func TestPushoverNotifier(t *testing.T) {
|
||||
Convey("Pushover notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
@@ -65,7 +64,6 @@ func TestPushoverNotifier(t *testing.T) {
|
||||
|
||||
func TestGenPushoverBody(t *testing.T) {
|
||||
Convey("Pushover body generation tests", t, func() {
|
||||
|
||||
Convey("Given common sounds", func() {
|
||||
sirenSound := "siren_sound_tst"
|
||||
successSound := "success_sound_tst"
|
||||
@@ -93,6 +91,5 @@ func TestGenPushoverBody(t *testing.T) {
|
||||
So(strings.Contains(pushoverBody.String(), successSound), ShouldBeTrue)
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -78,7 +78,6 @@ func init() {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// NewSensuNotifier is the constructor for the Sensu Notifier.
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func TestSensuNotifier(t *testing.T) {
|
||||
Convey("Sensu notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func TestSlackNotifier(t *testing.T) {
|
||||
Convey("Slack notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -33,7 +33,6 @@ func init() {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// NewTeamsNotifier is the constructor for Teams notifier.
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func TestTeamsNotifier(t *testing.T) {
|
||||
Convey("Teams notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -68,7 +68,6 @@ func init() {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// TelegramNotifier is responsible for sending
|
||||
@@ -247,7 +246,6 @@ func generateImageCaption(evalContext *alerting.EvalContext, ruleURL string, met
|
||||
|
||||
if len(message) > captionLengthLimit {
|
||||
message = message[0:captionLengthLimit]
|
||||
|
||||
}
|
||||
|
||||
if len(ruleURL) > 0 {
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
|
||||
func TestTelegramNotifier(t *testing.T) {
|
||||
Convey("Telegram notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
@@ -68,7 +67,6 @@ func TestTelegramNotifier(t *testing.T) {
|
||||
})
|
||||
|
||||
Convey("When generating a message", func() {
|
||||
|
||||
Convey("URL should be skipped if it's too long", func() {
|
||||
evalContext := alerting.NewEvalContext(context.Background(),
|
||||
&alerting.Rule{
|
||||
|
||||
@@ -98,7 +98,6 @@ func init() {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// ThreemaNotifier is responsible for sending
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
func TestThreemaNotifier(t *testing.T) {
|
||||
Convey("Threema notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func TestVictoropsNotifier(t *testing.T) {
|
||||
Convey("Victorops notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
@@ -74,7 +74,6 @@ func init() {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// NewWebHookNotifier is the constructor for
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
func TestWebhookNotifier(t *testing.T) {
|
||||
Convey("Webhook notifier tests", t, func() {
|
||||
|
||||
Convey("Parsing alert notification from settings", func() {
|
||||
Convey("empty settings should return error", func() {
|
||||
json := `{ }`
|
||||
|
||||
Reference in New Issue
Block a user