Skip to content

Commit

Permalink
Added test: no send repeats for broken contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Kolkov committed Mar 3, 2021
1 parent 9c75d2e commit 7deee8b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions notifier/notifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7deee8b

Please sign in to comment.