Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Kolkov committed Mar 5, 2021
1 parent f9ccd7e commit a2786fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ func disableBrokenContactSubscriptions(brokenContact *moira.ContactData, databas
if err != nil {
return 0, err
}
if len(subsIDs) == 0 {
return 0, nil
}

subs, e := database.GetSubscriptions(subsIDs)
if e != nil {
return 0, e
Expand Down
5 changes: 4 additions & 1 deletion notifier/notifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ func TestNoResendForSendToBrokenContact(t *testing.T) {
Events: eventsData,
Contact: moira.ContactData{
Type: "test",
User: "someuser",
},
}
sender.EXPECT().SendEvents(eventsData, pkg.Contact, pkg.Trigger, plots, pkg.Throttled).
Return(moira.NewSenderBrokenContactError(fmt.Errorf("some sender reason")))
dataBase.EXPECT().GetUserSubscriptionIDs(pkg.Contact.User).Return([]string{}, nil)

var wg sync.WaitGroup
notif.Send(&pkg, &wg)
Expand Down Expand Up @@ -236,7 +238,8 @@ func afterTest() {
var subID = "SubscriptionID-000000000000001"

var event = moira.NotificationEvent{
Metric: "generate.event.1",
Metric: "generate.event.1",

State: moira.StateOK,
OldState: moira.StateWARN,
TriggerID: "triggerID-0000000000001",
Expand Down

0 comments on commit a2786fb

Please sign in to comment.