Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions restapi/user_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,27 +167,27 @@ func TestWatch(t *testing.T) {
}
wo.Events() <- info
}
wo.Errors() <- &probe.Error{Cause: fmt.Errorf("error on Watch")}
wo.Errors() <- &probe.Error{Cause: fmt.Errorf("error on watch")}
}(wo)
return wo, nil
}
connWriteMessageMock = func(messageType int, data []byte) error {
return nil
}
if err := startWatch(ctx, mockWSConn, client, testOptions); assert.Error(err) {
assert.Equal("error on Watch", err.Error())
assert.Equal("error on watch", err.Error())
}

// Test-4: error happens on Watch, watch should stop
// and error shall be returned.
mcWatchMock = func(ctx context.Context, params mc.WatchOptions) (*mc.WatchObject, *probe.Error) {
return nil, &probe.Error{Cause: fmt.Errorf("error on Watch")}
return nil, &probe.Error{Cause: fmt.Errorf("error on watch")}
}
if err := startWatch(ctx, mockWSConn, client, testOptions); assert.Error(err) {
assert.Equal("error on Watch", err.Error())
assert.Equal("error on watch", err.Error())
}

// Test-5: return nil on error on Watch
// Test-5: return nil on error on watch
mcWatchMock = func(ctx context.Context, params mc.WatchOptions) (*mc.WatchObject, *probe.Error) {
wo := &mc.WatchObject{
EventInfoChan: make(chan []mc.EventInfo),
Expand Down