Alerting: Decouple default template from channel tests (#35239) (#35973)

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
(cherry picked from commit 33d6e11175)

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2021-06-20 22:54:29 -04:00
committed by GitHub
parent 46d1c1c112
commit 07bfa64bb4
3 changed files with 173 additions and 2 deletions
@@ -45,10 +45,13 @@ func TestNotificationChannels(t *testing.T) {
os, opa, ot, opu, ogb, ol, oth := channels.SlackAPIEndpoint, channels.PagerdutyEventAPIURL,
channels.TelegramAPIURL, channels.PushoverEndpoint, channels.GetBoundary,
channels.LineNotifyURL, channels.ThreemaGwBaseURL
originalTemplate := channels.DefaultTemplateString
channels.DefaultTemplateString = channels.TemplateForTestsString
t.Cleanup(func() {
channels.SlackAPIEndpoint, channels.PagerdutyEventAPIURL,
channels.TelegramAPIURL, channels.PushoverEndpoint, channels.GetBoundary,
channels.LineNotifyURL, channels.ThreemaGwBaseURL = os, opa, ot, opu, ogb, ol, oth
channels.DefaultTemplateString = originalTemplate
})
channels.SlackAPIEndpoint = fmt.Sprintf("http://%s/slack_recvX/slack_testX", mockChannel.server.Addr)
channels.PagerdutyEventAPIURL = fmt.Sprintf("http://%s/pagerduty_recvX/pagerduty_testX", mockChannel.server.Addr)