TaiJuWu commented on code in PR #17165:
URL: https://github.com/apache/kafka/pull/17165#discussion_r1762204798


##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -3443,6 +3443,33 @@ public void testPreventMultiThread(GroupProtocol 
groupProtocol) throws Interrupt
         }
     }
 
+    @ParameterizedTest
+    @EnumSource(value = GroupProtocol.class)
+    public void testPollSendRequestForRebalance(GroupProtocol groupProtocol) 
throws InterruptedException {
+        ConsumerMetadata metadata = createMetadata(subscription);
+        MockClient client = new MockClient(time, metadata);
+        initMetadata(client, Collections.singletonMap(topic, 1));
+        Node node = metadata.fetch().nodes().get(0);
+
+        
client.prepareResponseFrom(FindCoordinatorResponse.prepareResponse(Errors.NONE, 
groupId, node), node);
+        KafkaConsumer<String, String> consumer = newConsumer(groupProtocol, 
time, client, subscription, metadata,
+                assignor, true, groupInstanceId);
+        consumer.subscribe(singletonList(topic));

Review Comment:
   Sorry for the confusion.
   
   The reason for making the application sleep here is to give the network 
enough time to send the join request even without poll. This helps to reproduce 
the bug more easily and consistently.
   
   Additionally, to ensure the behavior we’ve promised in the documentation, 
the two operations (subscribe and poll) should not be too close together in the 
timeline. Does that make sense?



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