showuon commented on code in PR #12748: URL: https://github.com/apache/kafka/pull/12748#discussion_r1017395458
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerProtocolTest.java: ########## @@ -247,4 +245,42 @@ public void deserializeFutureAssignmentVersion() { Assignment assignment = ConsumerProtocol.deserializeAssignment(buffer); assertEquals(toSet(Collections.singletonList(tp1)), toSet(assignment.partitions())); } + + private ByteBuffer generateFutureSubscriptionVersionData(boolean hasGenerationId) { + // verify that a new version which adds a field is still parseable + short version = 100; + + Schema subscriptionSchemaV100 = new Schema( + new Field("topics", new ArrayOf(Type.STRING)), + new Field("user_data", Type.NULLABLE_BYTES), + new Field("owned_partitions", new ArrayOf( + ConsumerProtocolSubscription.TopicPartition.SCHEMA_1)), + hasGenerationId ? new Field("generation_id", Type.INT32) : new Field("foo", Type.STRING), Review Comment: I think you're right. The generation_id should always be there. I think this test is just to test we will always get the correct data no matter what new fields added. Updated the test. -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org