FrankYang0529 commented on code in PR #17958:
URL: https://github.com/apache/kafka/pull/17958#discussion_r1863713049


##########
core/src/test/scala/unit/kafka/server/ConsumerGroupDescribeRequestTest.scala:
##########
@@ -213,4 +216,111 @@ class ConsumerGroupDescribeRequestTest(cluster: 
ClusterInstance) extends GroupCo
       admin.close()
     }
   }
+
+  @ClusterTest(
+    types = Array(Type.KRAFT),
+    serverProperties = Array(
+      new ClusterConfigProperty(key = 
GroupCoordinatorConfig.OFFSETS_TOPIC_PARTITIONS_CONFIG, value = "1"),
+      new ClusterConfigProperty(key = 
GroupCoordinatorConfig.OFFSETS_TOPIC_REPLICATION_FACTOR_CONFIG, value = "1")
+    )
+  )
+  def testConsumerGroupDescribeWithMigrationMember(): Unit = {
+    // Creates the __consumer_offsets topics because it won't be created 
automatically
+    // in this test because it does not use FindCoordinator API.
+    createOffsetsTopic()
+
+    // Create the topic.
+    val topicName = "foo"
+    createTopic(
+      topic = "foo",
+      numPartitions = 3
+    )
+
+    val groupId = "grp"
+
+    // Classic member 1 joins the classic group.
+    val memberId1 = joinDynamicConsumerGroupWithOldProtocol(
+      groupId = groupId,
+      metadata = ConsumerProtocol.serializeSubscription(
+        new ConsumerPartitionAssignor.Subscription(
+          Collections.singletonList(topicName),
+          null,
+          List().asJava
+        )
+      ).array,
+      assignment = ConsumerProtocol.serializeAssignment(
+        new ConsumerPartitionAssignor.Assignment(
+          List(0, 1, 2).map(p => new TopicPartition(topicName, p)).asJava
+        )
+      ).array
+    )._1
+
+    // The joining request with a consumer group member 2 is accepted.
+    consumerGroupHeartbeat(
+      groupId = groupId,
+      memberId = "member-2",
+      rebalanceTimeoutMs = 5 * 60 * 1000,
+      subscribedTopicNames = List(topicName),
+      topicPartitions = List.empty,
+      expectedError = Errors.NONE
+    ).memberId()
+
+    // version 0 doesn't have isClassic field, so isClassic field on member 1 
is false
+    val actual = consumerGroupDescribe(
+      groupIds = List(groupId),
+      includeAuthorizedOperations = true,
+      version = 0.toShort,
+    )
+    assertEquals(1, actual.size)
+    val group = actual.head
+    val member1 = group.members().asScala.find(_.memberId() == memberId1)
+    assertNotNull(member1)
+    assertFalse(member1.get.isClassic)

Review Comment:
   I don't compare full response for two reasons:
   
   * It looks like we don't guarantee member order if there are multiple 
members. If we do assertion for group, it may fail cause of different member 
order.
   
https://github.com/apache/kafka/blob/9d23f89e05782875f5f37f1e9687c621b0e3edb8/group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/consumer/ConsumerGroup.java#L954-L961
   
   * For uniform assignor, the target assignment result may change.
   
   So I think we can focus on `isClassic` field.



-- 
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

Reply via email to