From 7deee8b74f175dda550efd02f0e229baee2888c7 Mon Sep 17 00:00:00 2001 From: Andrey Kolkov Date: Wed, 3 Mar 2021 12:27:07 +0400 Subject: [PATCH] Added test: no send repeats for broken contacts --- notifier/notifier_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/notifier/notifier_test.go b/notifier/notifier_test.go index f000f2ebe..2736c72f4 100644 --- a/notifier/notifier_test.go +++ b/notifier/notifier_test.go @@ -117,6 +117,27 @@ func TestFailSendEvent(t *testing.T) { time.Sleep(time.Second * 2) } +func TestNoResendForSendToBrokenContact(t *testing.T) { + configureNotifier(t) + defer afterTest() + + var eventsData moira.NotificationEvents = []moira.NotificationEvent{event} + + pkg := NotificationPackage{ + Events: eventsData, + Contact: moira.ContactData{ + Type: "test", + }, + } + sender.EXPECT().SendEvents(eventsData, pkg.Contact, pkg.Trigger, plots, pkg.Throttled). + Return(moira.NewSenderBrokenContactError(fmt.Errorf("some sender reason"))) + + var wg sync.WaitGroup + notif.Send(&pkg, &wg) + wg.Wait() + time.Sleep(time.Second * 2) +} + func TestTimeout(t *testing.T) { configureNotifier(t) var wg sync.WaitGroup