KAFKA-14133: Migrate Admin mock in TaskManagerTest to Mockito#13712
KAFKA-14133: Migrate Admin mock in TaskManagerTest to Mockito#13712cadonna merged 2 commits intoapache:trunkfrom
Conversation
There was a problem hiding this comment.
This line is removed, and I wonder whether we should add a similar assertion for the adminClient mock after each of these two calls: https://github.com/apache/kafka/blob/ff6b6dd601d9a6156dba249a8b52201a34eaca13/streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java#L3775-L3779
There was a problem hiding this comment.
Heya, thank you for the review! I am not quite certain I follow what you mean. The reason this is removed here and elsewhere is that Mockito verifies internally that all when statements are called. EasyMock does not do this by default so it requires an explicit verification.
There was a problem hiding this comment.
You are right; I didn't notice that we are using STRICT_STUBS strictness: https://github.com/apache/kafka/blob/ff6b6dd601d9a6156dba249a8b52201a34eaca13/streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java#L208
Thanks for the reply!
There was a problem hiding this comment.
There was a problem hiding this comment.
There was a problem hiding this comment.
I think you need to verify the order of the calls since the admin mock is reset to strict in EasyMock. The order is indeed important here because you do not want to purge records in the wrong order from a repartition topic.
|
Heya @cadonna! I hope I have addressed your comment, rebased and updated the overview! |
cadonna
left a comment
There was a problem hiding this comment.
LGTM!
There is just one checkstyle failure that I tried to correct.
…nals/TaskManagerTest.java
|
Build failures are unrelated: |
|
Heya @cadonna! Is there something I need to do or this can be merged? |
|
I was not sure. The description says
Can I merge it anyways? |
|
Ah, sorry, yeah, I have caused the confusion. Technically the order of merging between this and #13711 doesn't matter as long as one is rebased on top of the other afterwards. This appears to be ready to merge so let's go with merging this and I will then update 13711. |
|
Thank you! I will now address the comments on the other one! |
This pull requests migrates the Admin mock 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)
Similar to:
#13529
#13621
#13681
#13711
This needs to be rebased on top of #13711 before merging