Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
mabdh committed Jul 27, 2023
1 parent 95b9b16 commit 0e55f17
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions core/notification/dispatch_receiver_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestDispatchReceiverService_PrepareMessage(t *testing.T) {
},
},
setup: func(rs *mocks.ReceiverService, n *mocks.Notifier) {
rs.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("receiver.GetOption")).Return(nil, errors.New("some error"))
rs.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), mock.AnythingOfType("uint64")).Return(nil, errors.New("some error"))
},
wantErr: true,
},
Expand All @@ -53,7 +53,7 @@ func TestDispatchReceiverService_PrepareMessage(t *testing.T) {
},
},
setup: func(rs *mocks.ReceiverService, n *mocks.Notifier) {
rs.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("receiver.GetOption")).Return(&receiver.Receiver{}, nil)
rs.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), mock.AnythingOfType("uint64")).Return(&receiver.Receiver{}, nil)
},
wantErr: true,
},
Expand All @@ -65,7 +65,7 @@ func TestDispatchReceiverService_PrepareMessage(t *testing.T) {
},
},
setup: func(rs *mocks.ReceiverService, n *mocks.Notifier) {
rs.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("receiver.GetOption")).Return(&receiver.Receiver{
rs.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), mock.AnythingOfType("uint64")).Return(&receiver.Receiver{
Type: testPluginType,
}, nil)
n.EXPECT().PreHookQueueTransformConfigs(mock.AnythingOfType("*context.emptyCtx"), mock.AnythingOfType("map[string]interface {}")).Return(nil, errors.New("some error"))
Expand All @@ -80,7 +80,7 @@ func TestDispatchReceiverService_PrepareMessage(t *testing.T) {
},
},
setup: func(rs *mocks.ReceiverService, n *mocks.Notifier) {
rs.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), mock.AnythingOfType("uint64"), mock.AnythingOfType("receiver.GetOption")).Return(&receiver.Receiver{
rs.EXPECT().Get(mock.AnythingOfType("*context.emptyCtx"), mock.AnythingOfType("uint64")).Return(&receiver.Receiver{
ID: 11,
Type: testPluginType,
}, nil)
Expand Down
5 changes: 1 addition & 4 deletions core/notification/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,7 @@ func TestService_BuildFromAlerts(t *testing.T) {
errString: "empty alerts",
},
{
name: `should properly return notification
- same annotations are joined by newline
- different labels are splitted into two notifications
`,
name: "should properly return notification (same annotations are joined by newline and different labels are splitted into two notifications)",
alerts: []alert.Alert{
{
ID: 14,
Expand Down
2 changes: 1 addition & 1 deletion core/receiver/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func TestService_UpdateReceiver(t *testing.T) {
"token": "key",
},
}, nil)
ss.EXPECT().PreHookDBTransformConfigs(mock.AnythingOfType("*context.emptyCtx"), map[string]any{"token": "key"}, 0).Return(nil, errors.New("some error"))
ss.EXPECT().PreHookDBTransformConfigs(mock.AnythingOfType("*context.emptyCtx"), map[string]any{"token": "key"}, uint64(0)).Return(nil, errors.New("some error"))
},
Rcv: &receiver.Receiver{
ID: 123,
Expand Down

0 comments on commit 0e55f17

Please sign in to comment.