hysuuuu commented on code in PR #23343:
URL: https://github.com/apache/kafka/pull/23343#discussion_r3997370056


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/ClientRebootstrapTest.java:
##########
@@ -66,17 +65,15 @@ public void testAdminRebootstrap(ClusterInstance 
clusterInstance) {
             admin.createTopics(List.of(new NewTopic(TOPIC, PARTITIONS, (short) 
REPLICAS)));
 
             // Only the broker 1 is available for the admin client during the 
bootstrap.
-            var topics = assertDoesNotThrow(() -> 
admin.listTopics().names().get(timeout, TimeUnit.SECONDS));
-            assertTrue(topics.contains(TOPIC));
+            TestUtils.waitForCondition(() -> admin.listTopics().names().get(5, 
TimeUnit.SECONDS).contains(TOPIC), timeout * 1000, "Topic not visible after 
creation");
 
             clusterInstance.shutdownBroker(broker1);
             clusterInstance.startBroker(broker0);
 
             // The broker 1, originally cached during the bootstrap, is 
offline.
             // However, the broker 0 from the bootstrap list is online.
             // Should be able to list topics again.
-            topics = assertDoesNotThrow(() -> 
admin.listTopics().names().get(timeout, TimeUnit.SECONDS));
-            assertTrue(topics.contains(TOPIC));
+            TestUtils.waitForCondition(() -> admin.listTopics().names().get(5, 
TimeUnit.SECONDS).contains(TOPIC), timeout * 1000, "Topic not visible after 
broker restart");

Review Comment:
   Yes you're right, the topic metatdata is already synced at this point.
   My original thought was maybe the AdminClient still needs time to detect 
disconnection and re-bootstrap after the broker restarts. But using 
waitForCondition might be redundant as you said. I'll revert it. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to