KAFKA-13763 (2): Refactor IncrementalCooperativeAssignor for improved unit testing#11983
KAFKA-13763 (2): Refactor IncrementalCooperativeAssignor for improved unit testing#11983showuon merged 5 commits intoapache:trunkfrom
Conversation
…gnment to eliminate mocking and simplify parameters
…nments to simplify parameters
|
Thanks @showuon, pushed the requested changes 👍 |
|
Thanks @showuon, good call with the improvement to the serialization logic. Took a bit of legwork but I've pushed a change that implements that and also cleans up some testing clutter; LMKWYT. |
There was a problem hiding this comment.
Sorry, @C0urante , I was wrong. serializeMetadata will be called in metadataRequest method. And the metadataRequest is trying to create a JoinGroupRequestProtocolCollection containing all supported protocols. So if it's sessioned, we should return a collection containing sessioned, compatible, eagar. But after our change, we will return sessioned, sessioned, eagar, which is wrong. I think we should keep sessioned argument here.
There was a problem hiding this comment.
Ah, good catch! I've pushed a fix but tried to keep the improvement to the serialization API; if you'd prefer to go back to the sessioned boolean LMK.
There was a problem hiding this comment.
I think we go back to sessioned in serializeMetadata method will make metadataRequest looks cleaner. Sorry that I didn't make it clear.
There was a problem hiding this comment.
No worries, done! Sorry for the delay.
showuon
left a comment
There was a problem hiding this comment.
LGTM! Thanks for the improvement.
|
Failed tests are unrelated. |
|
Thanks Luke! |
Jira
Builds on the changes from #11974, which exclusively touched on the
IncrementalCooperativeAssignorTesttest suite.The goals here include:
IncrementalCooperativeAssignor::performTaskAssignmentmethod that is more testing friendly by:ClusterAssignmentclass, which eliminates the current pattern of creating a mockIncrementalCooperativeAssignorclass, spying on one of its private methods, and capturing the argument passed to that spied-upon methodWorkerCoordinatorinstance during testingMap<String, ConnectorsAndTasks>for the set of currently-running connectors and tasks across the cluster, instead of aMap<String, ExtendedWorkerState>, which contains unnecessary information like the leader, leader URL, protocol version, and config topic offsetIncrementalCooperativeAssignor::handleLostAssignmentsmethod, which in turn simplifies the logic for testing this classConnectUtilsclassCommitter Checklist (excluded from commit message)