Chris Egerton created KAFKA-13763:
-------------------------------------

             Summary: Improve unit testing coverage for 
IncrementalCooperativeAssignor
                 Key: KAFKA-13763
                 URL: https://issues.apache.org/jira/browse/KAFKA-13763
             Project: Kafka
          Issue Type: Improvement
          Components: KafkaConnect
            Reporter: Chris Egerton
            Assignee: Chris Egerton


The 
[tests|https://github.com/apache/kafka/blob/dcd09de1ed84b43f269eb32fc2baf589a791d468/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/IncrementalCooperativeAssignorTest.java]
 for the {{IncrementalCooperativeAssignor}} class provide a moderate level of 
coverage and cover some non-trivial cases, but there are some areas for 
improvement that will allow us to iterate on the assignment logic for Kafka 
Connect faster and with greater confidence.

These improvements include:
 * Adding reusable utility methods to assert that a cluster's assignment is 
*balanced* (the difference in the number of connectors and tasks assigned to 
any two workers is at most one) and *complete* (all connectors and tasks are 
assigned to a worker)
 * Removing the existing 
[assertAssignment|https://github.com/apache/kafka/blob/dcd09de1ed84b43f269eb32fc2baf589a791d468/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/IncrementalCooperativeAssignorTest.java#L1373-L1405]
 methods and replacing them with a more fine-grained alternative that allows 
for more granular assertions about the number of tasks/connectors 
assigned/revoked from each worker during a round of rebalance, instead of the 
total for the entire cluster
 * Adding a reusable utility method to assert the current distribution of 
connectors and tasks across the cluster
 * Decomposing large portions of repeated code for simulating a round of 
rebalancing into a reusable utility method
 * Renaming variable names to improve accuracy/readability (the 
{{expectedMemberConfigs}} field, for example, is pretty poorly named)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to