FrankYang0529 commented on code in PR #17165: URL: https://github.com/apache/kafka/pull/17165#discussion_r1762181434
########## 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: Hi @TaiJuWu, `application` and `network` are different threads. I'm not sure why making `application` thread sleep can let `network` thread doesn't send join request. Also , this test would like to make sure `KafkaConsumer#subscribe` doesn't send join request, so we should not have other operations to make the result. Could you elaborate more about your idea? Thank you. -- 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