You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/10/27 03:40:26 UTC

[GitHub] [kafka] chia7712 commented on a change in pull request #9506: KAFKA-10647; Only serialize owned partitions when consumer protocol version >= 1

chia7712 commented on a change in pull request #9506:
URL: https://github.com/apache/kafka/pull/9506#discussion_r512397607



##########
File path: clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerProtocolTest.java
##########
@@ -137,6 +161,19 @@ public void deserializeFutureSubscriptionVersion() {
         assertEquals(groupInstanceId, subscription.groupInstanceId());
     }
 
+    @Test
+    public void serializeDeserializeAssignmentAllVersions() {
+        List<TopicPartition> partitions = Arrays.asList(tp1, tp2);
+        Assignment assignment = new Assignment(partitions, ByteBuffer.wrap("hello".getBytes()));
+
+        for (short version = ConsumerProtocolAssignment.LOWEST_SUPPORTED_VERSION; version <= ConsumerProtocolAssignment.HIGHEST_SUPPORTED_VERSION; version++) {
+            ByteBuffer buffer = ConsumerProtocol.serializeAssignment(assignment, version);
+            Assignment parsedAssignment = ConsumerProtocol.deserializeAssignment(buffer);
+            assertEquals(toSet(partitions), toSet(parsedAssignment.partitions()));
+            assertEquals(parsedAssignment.userData(), parsedAssignment.userData());

Review comment:
       Does it compare to incorrect object (maybe ```assignment.userData()```)?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org