chia7712 commented on code in PR #16852: URL: https://github.com/apache/kafka/pull/16852#discussion_r1730243962
########## core/src/test/java/kafka/test/ClusterTestExtensionsTest.java: ########## @@ -236,6 +236,37 @@ public void testNotSupportedNewGroupProtocols(ClusterInstance clusterInstance) { Assertions.assertEquals(1, clusterInstance.supportedGroupProtocols().size()); } + + + @ClusterTest(types = {Type.ZK, Type.CO_KRAFT, Type.KRAFT}, brokers = 3) + public void testCreateTopic(ClusterInstance clusterInstance) throws Exception { + String topicName = "test"; + int partitions = 3; + short replicas = 3; + clusterInstance.createTopic(topicName, partitions, replicas); + clusterInstance.waitForTopic(topicName, partitions); + + try (Admin admin = clusterInstance.createAdminClient()) { + Assertions.assertTrue(admin.listTopics().listings().get().stream().anyMatch(s -> s.name().equals(topicName))); + } + } + + @ClusterTest(types = {Type.ZK, Type.CO_KRAFT, Type.KRAFT}, brokers = 3) + public void testWaitForMetadataSync(ClusterInstance clusterInstance) throws Exception { + String topicName = "test"; + int partitions = 3; + short replicas = 3; + clusterInstance.createTopic(topicName, partitions, replicas); + clusterInstance.waitForTopic(topicName, partitions); + + long offset = clusterInstance.waitForMeatdataSync(); Review Comment: Could you please write test to make sure "it works well" rather than checking the return value. For example, the method is used to "wait" the metadata. Hence, we should make some metadata changes and then call `waitForMetadataSync`. Finally, we call the APIs using the metadata to check the metadata is synced. ########## core/src/test/java/kafka/test/ClusterInstance.java: ########## @@ -187,6 +188,14 @@ default void waitTopicDeletion(String topic) throws InterruptedException { waitForTopic(topic, 0); } + long waitForMeatdataSync() throws InterruptedException; Review Comment: `waitForMetadataSync` Also, what is the purpose of the return value? -- 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