Chore: Remove bus from ngalert (#44465)

* pass notification service down to the notifiers

* add ns to all notifiers

* remove bus from ngalert notifiers

* use smaller interfaces for notificationservice

* attempt to fix the tests

* remove unused struct field

* simplify notification service mock

* trying to resolve issues in the tests

* make linter happy

* make linter even happier

* linter, you are annoying
This commit is contained in:
Serge Zaitsev
2022-01-26 16:42:40 +01:00
committed by GitHub
parent ad4a9a48d2
commit 84a5910e56
48 changed files with 374 additions and 374 deletions
@@ -493,37 +493,37 @@ func (m *migration) validateAlertmanagerConfig(orgID int64, config *PostableUser
switch gr.Type {
case "email":
_, err = channels.NewEmailNotifier(cfg, nil) // Email notifier already has a default template.
_, err = channels.NewEmailNotifier(cfg, nil, nil) // Email notifier already has a default template.
case "pagerduty":
_, err = channels.NewPagerdutyNotifier(cfg, nil, decryptFunc)
_, err = channels.NewPagerdutyNotifier(cfg, nil, nil, decryptFunc)
case "pushover":
_, err = channels.NewPushoverNotifier(cfg, nil, decryptFunc)
_, err = channels.NewPushoverNotifier(cfg, nil, nil, decryptFunc)
case "slack":
_, err = channels.NewSlackNotifier(cfg, nil, decryptFunc)
case "telegram":
_, err = channels.NewTelegramNotifier(cfg, nil, decryptFunc)
_, err = channels.NewTelegramNotifier(cfg, nil, nil, decryptFunc)
case "victorops":
_, err = channels.NewVictoropsNotifier(cfg, nil)
_, err = channels.NewVictoropsNotifier(cfg, nil, nil)
case "teams":
_, err = channels.NewTeamsNotifier(cfg, nil)
_, err = channels.NewTeamsNotifier(cfg, nil, nil)
case "dingding":
_, err = channels.NewDingDingNotifier(cfg, nil)
_, err = channels.NewDingDingNotifier(cfg, nil, nil)
case "kafka":
_, err = channels.NewKafkaNotifier(cfg, nil)
_, err = channels.NewKafkaNotifier(cfg, nil, nil)
case "webhook":
_, err = channels.NewWebHookNotifier(cfg, nil, decryptFunc)
_, err = channels.NewWebHookNotifier(cfg, nil, nil, decryptFunc)
case "sensugo":
_, err = channels.NewSensuGoNotifier(cfg, nil, decryptFunc)
_, err = channels.NewSensuGoNotifier(cfg, nil, nil, decryptFunc)
case "discord":
_, err = channels.NewDiscordNotifier(cfg, nil)
_, err = channels.NewDiscordNotifier(cfg, nil, nil)
case "googlechat":
_, err = channels.NewGoogleChatNotifier(cfg, nil)
_, err = channels.NewGoogleChatNotifier(cfg, nil, nil)
case "LINE":
_, err = channels.NewLineNotifier(cfg, nil, decryptFunc)
_, err = channels.NewLineNotifier(cfg, nil, nil, decryptFunc)
case "threema":
_, err = channels.NewThreemaNotifier(cfg, nil, decryptFunc)
_, err = channels.NewThreemaNotifier(cfg, nil, nil, decryptFunc)
case "opsgenie":
_, err = channels.NewOpsgenieNotifier(cfg, nil, decryptFunc)
_, err = channels.NewOpsgenieNotifier(cfg, nil, nil, decryptFunc)
case "prometheus-alertmanager":
_, err = channels.NewAlertmanagerNotifier(cfg, nil, decryptFunc)
default: