lucasbru commented on code in PR #23638:
URL: https://github.com/apache/kafka/pull/23638#discussion_r4641384585


##########
core/src/test/scala/unit/kafka/server/StreamsGroupDescribeRequestTest.scala:
##########
@@ -44,6 +44,124 @@ import java.lang.{Byte => JByte}
 )
 class StreamsGroupDescribeRequestTest(cluster: ClusterInstance) extends 
GroupCoordinatorBaseRequestTest(cluster) {
 
+  @ClusterTest(
+    serverProperties = Array(
+      new ClusterConfigProperty(key = 
GroupCoordinatorConfig.STREAMS_GROUP_INITIAL_REBALANCE_DELAY_MS_CONFIG, value = 
"0"),
+      new ClusterConfigProperty(key = 
GroupCoordinatorConfig.STREAMS_GROUP_ASSIGNOR_OFFLOAD_ENABLE_CONFIG, value = 
"false")
+    )
+  )
+  def testStreamsGroupDescribeIncludesTasksPendingRevocation(): Unit = {
+    createOffsetsTopic()
+    createTopic(topic = "foo", numPartitions = 2)
+
+    val topology = new StreamsGroupHeartbeatRequestData.Topology()
+      .setEpoch(1)
+      .setSubtopologies(List(
+        new StreamsGroupHeartbeatRequestData.Subtopology()
+          .setSubtopologyId("subtopology-1")
+          .setSourceTopics(List("foo").asJava)
+          .setRepartitionSinkTopics(List.empty.asJava)
+          .setRepartitionSourceTopics(List.empty.asJava)
+          .setStateChangelogTopics(List.empty.asJava)
+      ).asJava)
+
+    // Member-1 joins and receives both active tasks.
+    var member1Response: StreamsGroupHeartbeatResponseData = null
+    TestUtils.waitUntilTrue(() => {
+      member1Response = streamsGroupHeartbeat(
+        groupId = "grp",
+        memberId = "member-1",
+        processId = "process-1",
+        rebalanceTimeoutMs = 5 * 60 * 1000,
+        activeTasks = List.empty,
+        standbyTasks = List.empty,
+        warmupTasks = List.empty,
+        topology = topology
+      )
+      member1Response.activeTasks != null &&
+        
member1Response.activeTasks.asScala.flatMap(_.partitions.asScala).toSet == 
Set[Integer](0, 1)
+    }, msg = s"Member-1 did not receive both tasks. Last response 
$member1Response.")
+
+    // Member-2 joins, moving one task to its target assignment.
+    val member2Response = streamsGroupHeartbeat(
+      groupId = "grp",
+      memberId = "member-2",
+      processId = "process-2",
+      rebalanceTimeoutMs = 5 * 60 * 1000,
+      activeTasks = List.empty,
+      standbyTasks = List.empty,
+      warmupTasks = List.empty,
+      topology = topology
+    )
+
+    // Member-1 reports that it still owns both tasks and receives a 
revocation request.
+    // Do not acknowledge the reduced assignment: the revoked task is still 
pending.
+    val revocationResponse = streamsGroupHeartbeat(
+      groupId = "grp",
+      memberId = "member-1",
+      memberEpoch = member1Response.memberEpoch,
+      activeTasks = convertTaskIds(member1Response.activeTasks),
+      standbyTasks = List.empty,
+      warmupTasks = List.empty
+    )
+    assertEquals(1, 
revocationResponse.activeTasks.asScala.flatMap(_.partitions.asScala).size)

Review Comment:
   @chickenchickenlove You didn't respond, address or resolve this comment. 
feel free to push back on AI, but please react to it.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to