Skip to content

Conversation

@korniltsev
Copy link
Contributor

No description provided.

@korniltsev korniltsev requested a review from a team as a code owner August 26, 2024 17:10
Comment on lines +225 to +235
bucket := mockobjstore.NewMockBucket(t)
bucket.On("Upload", mock.Anything, mock.MatchedBy(func(name string) bool {
return strings.HasSuffix(name, pathBlock)
}), mock.Anything).Return(nil)
bucket.On("Upload", mock.Anything, mock.MatchedBy(func(name string) bool {
return strings.Contains(name, pathDLQ)
}), mock.Anything).Return(fmt.Errorf("mock upload DLQ error"))
client := mockmetastorev1.NewMockMetastoreServiceClient(t)
client.On("AddBlock", mock.Anything, mock.Anything, mock.Anything).
Return(nil, fmt.Errorf("mock add block error"))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may also want to specify whether each method (and how many times) was called and AssertExpectations in the end. Otherwise, if a method has not been called, the test will pass (unless you assert side-effects, which you do)

@korniltsev korniltsev merged commit 5c15835 into main Aug 27, 2024
@korniltsev korniltsev deleted the korniltsev/segment_writer_mocks branch August 27, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants