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 9, 2021
1 parent a2d5ac2 commit ea864f9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
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
1 change: 0 additions & 1 deletion senders/telegram/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package telegram
import (
"bytes"
"fmt"
"github.com/moira-alert/moira/notifier"
"strings"

"gopkg.in/tucnak/telebot.v2"
Expand Down

0 comments on commit ea864f9

Please sign in to comment.