chia7712 commented on code in PR #16323: URL: https://github.com/apache/kafka/pull/16323#discussion_r1639102144
########## core/src/test/java/kafka/test/ClusterTestExtensionsTest.java: ########## @@ -232,4 +232,17 @@ public void testNotSupportedNewGroupProtocols(ClusterInstance clusterInstance) { Assertions.assertTrue(clusterInstance.supportedGroupProtocols().contains(CLASSIC)); Assertions.assertEquals(1, clusterInstance.supportedGroupProtocols().size()); } + + @ClusterTest(brokers = 4) + public void testClusterAliveBrokers(ClusterInstance clusterInstance) throws Exception { + clusterInstance.waitForReadyBrokers(); + clusterInstance.shutdownBroker(0); + List<Integer> aliveBrokerAfterShutdown = Arrays.asList(1, 2, 3); + + Assertions.assertEquals(3, clusterInstance.aliveBrokers().size()); + + clusterInstance.aliveBrokers().forEach(s -> Assertions.assertTrue( Review Comment: It would be better to make sure they are definitely identical. ``` Assertions.assertEquals(aliveBrokerAfterShutdown, clusterInstance.aliveBrokers().stream().map(s -> s.config().brokerId()).collect(Collectors.toList())); ``` ########## core/src/test/java/kafka/test/ClusterInstance.java: ########## @@ -51,6 +52,10 @@ default boolean isKRaftTest() { Map<Integer, KafkaBroker> brokers(); + default List<KafkaBroker> aliveBrokers() { Review Comment: Could it return `Map<Integer, KafkaBroker>` which is same as `brokers`? -- 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