Skip to content

Commit 4a3158d

Browse files
samiulsamiImtiaz246
authored andcommitted
fix tests by adding mock metrics object
Signed-off-by: sami <sami@appscode.com>
1 parent 9e17d1b commit 4a3158d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/listener/listener_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func TestListener_slotIsExists(t *testing.T) {
2727
}
2828

2929
repo := new(repositoryMock)
30+
metrics := new(monitorMock)
3031

3132
setGetSlotLSN := func(slotName, lsn string, err error) {
3233
repo.On("GetSlotLSN", mock.Anything, slotName).
@@ -97,6 +98,7 @@ func TestListener_slotIsExists(t *testing.T) {
9798
cfg: &apis.Config{Listener: &apis.ListenerCfg{
9899
SlotName: tt.fields.slotName,
99100
}},
101+
monitor: metrics,
100102
repository: repo,
101103
}
102104

@@ -263,6 +265,7 @@ func TestListener_AckWalMessage(t *testing.T) {
263265
}
264266

265267
repl := new(replicatorMock)
268+
metrics := new(monitorMock)
266269

267270
setSendStandbyStatusUpdate := func(lsn pglogrepl.LSN, err error) {
268271
repl.On(
@@ -320,6 +323,7 @@ func TestListener_AckWalMessage(t *testing.T) {
320323
log: logger,
321324
replicator: repl,
322325
lsn: tt.fields.restartLSN,
326+
monitor: metrics,
323327
}
324328
if err := w.AckWalMessage(context.Background(), tt.args.LSN); (err != nil) != tt.wantErr {
325329
t.Errorf("AckWalMessage() error = %v, wantErr %v", err, tt.wantErr)

0 commit comments

Comments
 (0)