-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Replace EasyMock/PowerMock with Mockito in DistributedHerderTest #11792
Replace EasyMock/PowerMock with Mockito in DistributedHerderTest #11792
Conversation
...untime/src/test/java/org/apache/kafka/connect/runtime/distributed/DistributedHerderTest.java
Outdated
Show resolved
Hide resolved
Thanks for the PR @jeff303! Let me know when it is ready for review. |
Adding mockitoJunitJupiter test dependency to :connect:runtime project Converting class level mocks from EasyMock -> Mockito Changing first test (testJoinAssignment) to use Mockito constructs, along with its assertion helper methods
Hack to work around mockito/mockito#2601
ecf8629
to
d749bb9
Compare
Made a bit more progress on this. Converting Also, had to put in a hacky workaround for mockito/mockito#2601 for now. |
…IncrementalCooperativeRebalanceWithDelay A couple misc fixes to testIncrementalCooperativeRebalanceForNewMember
Something I've learned, that I feel is not adequately covered by this wiki: EasyMock expectations seem to stack up, as you build them. Or perhaps more like a FIFO queue. Expectations are queued up, then as invocations happen, the front of the queue is removed to satisfy the invocation, and the next mock is moved to the front. On the other hand, Mockito only seems to have a single current mock behavior for a particular set of argument matchers. This means that new expectations can't be set until after the actual code exercises the first one (ex: the calls to Just an observation for anyone else (or myself) in the future that is hopefully useful. |
@jeff303 do you still plan to work on this? Happy to provide a round of review for what's here already if you'd like some feedback. |
@divijvaidya This is another conversion PR that needs help if you have cycles. It would also simplify #12295. |
Hey @ijuma! Divij is taking some time off, but I can have a look in the meantime and try to get it over the line. |
Thanks @clolov ! |
Hi @clolov, just an info, to avoid duplicate work.. I've started working on this one few days ago. |
Okay @dplavcic! Thanks both for picking it up and for letting us know :) |
Hi @dplavcic, are you still working on this issue? |
Yes, I will add the MR soon (next week). |
Hi @dplavcic! Any update? The refactoring to the |
Hi @C0urante, I'm really sorry but I didn't have time to complete this on planned schedule (last week). It would be awesome if someone else can complete this (and unblock other PRs). |
@dplavcic No worries, it happens :) @yashmayya @mdedetrich @clolov @divijvaidya any interest in taking this one on? Fairly high-priority as it's blocking other PRs. |
@C0urante I won't be able to pick this up until 16th Oct. If no one has picked this up my then, I would happily pick it up. A problem that is common amongst the tests that I am migrating (
Does anyone else have a better solution to this? In my scenario, I want to queue expectations for |
I will start looking into it to see how I can help |
@divijvaidya I've also used the It's also worth noting that, due to the interleaving of setting up mock expectations with actually executing test code, often times it's not actually necessary to establish multiple expectations on a single mock when using Mockito. There are exceptions for this, of course, but otherwise, it's usually better to set a single expectation, run some test code, set a new expectation, etc. instead of setting up everything all at once (which is necessary with EasyMock/PowerMock). |
@mdedetrich Great, thanks! I've assigned KAFKA-13187 to you to let others know that the ticket is being worked on. If you need to drop this for some reason, can you unassign the ticket and ping me either here or on the ticket? |
Realistically, I am not going to have time to finish this one up, despite having spent a considerable amount of time months back. Hopefully some others can build upon what I discovered to finish it up. |
@mdedetrich are you still planning to work on this one? If not, I'd be happy to take this on and try to drive it to closure soon. |
@yashmayya I am currently on a company offside, will get back to you on this at the end of the week |
@yashmayya I don't really have time to finish this any time soon so feel free to take over |
@mdedetrich no problem, I've assigned https://issues.apache.org/jira/browse/KAFKA-13187 to myself and I'll start working on it next week. |
Adding mockitoJunitJupiter test dependency to :connect:runtime project
Converting class level mocks from EasyMock -> Mockito
Changing first test (testJoinAssignment) to use Mockito constructs, along with its assertion helper methods