chia7712 commented on code in PR #20064: URL: https://github.com/apache/kafka/pull/20064#discussion_r2173616671
########## tools/src/test/java/org/apache/kafka/tools/consumer/group/DescribeConsumerGroupTest.java: ########## @@ -1053,6 +1054,63 @@ public void testDescribeNonOffsetCommitGroup(ClusterInstance clusterInstance) th } } + /** + * The config `OFFSETS_TOPIC_REPLICATION_FACTOR_CONFIG` needs to be set to a value greater than 1 to ensure the + * normal invocation of APIs such as `FIND_COORDINATOR` when a broker has shutdown + */ + @ClusterTest(brokers = 3, serverProperties = {@ClusterConfigProperty(key = OFFSETS_TOPIC_REPLICATION_FACTOR_CONFIG, value = "2")}) + public void testDescribeConsumerGroupWithoutLeaders(ClusterInstance clusterInstance) throws Exception { + int brokerNum = 3; + this.clusterInstance = clusterInstance; + + // define topic and group, then send 5 records to each partition + String topic = TOPIC_PREFIX + UUID.randomUUID(); + String group = GROUP_PREFIX + UUID.randomUUID(); + clusterInstance.createTopic(topic, brokerNum, (short) 1); + for (int i = 0; i < brokerNum; i++) { + sendRecords(topic, i, 5); + } + + // append the command + List<String> cgcArgs = new ArrayList<>(List.of("--bootstrap-server", clusterInstance.bootstrapServers(), "--describe", "--group", group, "--all-topics")); + + try (AutoCloseable protocolConsumerGroupExecutor = consumerGroupClosable(GroupProtocol.CLASSIC, group, topic, Map.of()); + ConsumerGroupCommand.ConsumerGroupService service = consumerGroupService(cgcArgs.toArray(new String[0])); + Admin admin = clusterInstance.admin() + ) { + // shutdown the target broker + int noneLeaderPartition = 2; + int shutdownBrokerId = clusterInstance.getLeaderBrokerId(new TopicPartition(topic, noneLeaderPartition)); + clusterInstance.shutdownBroker(shutdownBrokerId); Review Comment: Shutting down the broker could cause some admin APIs to hang, so could you please add timeout to this test in order to avoid impacting CI? -- 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