New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-14133: Migrate various mocks in TaskManagerTest to Mockito #13874
Conversation
|
||
when(activeTaskCreator.createTasks(any(), Mockito.eq(taskId00Assignment))).thenReturn(singletonList(activeTask)); | ||
activeTask.prepareRecycle(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verify please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this because it was never invoked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for this is that the method in which prepareRecycle
is used is the mocked createStandbyTaskFromActive
of standbyTaskCreator
. Let me know in case I am wrong
|
||
shouldCommitViaProducerIfEosEnabled(ProcessingMode.EXACTLY_ONCE_V2, producer, offsetsT01, offsetsT02); | ||
Mockito.verify(producer).commitTransaction(allOffsets, new ConsumerGroupMetadata("appId")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, verifyNoMoreInteractions since the old easymock verify(producer) was verifying all invocations.
…nd StreamProducer mocks in TaskManagerTest to Mockito
62f188b
to
5f4a61e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes Christo. Looks good to me.
(I have verified that TaskManagerTest is successful in the CI, rest all failures are unrelated to this change)
…che#13874) Reviewers: Divij Vaidya <diviv@amazon.com>
…che#13874) Reviewers: Divij Vaidya <diviv@amazon.com>
…che#13874) Reviewers: Divij Vaidya <diviv@amazon.com>
This pull requests migrates the StreamTask, StandByTask, ProcessorStateManager and StreamProducer mocks in TaskManagerTest from EasyMock to Mockito.
The change is restricted to a single mock to minimize the scope and make it easier for review.
The reasoning as to why we would like to migrate a single mock rather than all mocks in the file at the same time has been discussed in #12607 (comment)
It takes the same approach as in:
#13529
#13621
#13681
#13711