dengziming commented on code in PR #12104: URL: https://github.com/apache/kafka/pull/12104#discussion_r862353579
########## core/src/test/scala/integration/kafka/admin/TopicCommandIntegrationTest.scala: ########## @@ -733,12 +733,18 @@ class TopicCommandIntegrationTest extends KafkaServerTestHarness with Logging wi killBroker(0) val aliveServers = brokers.filterNot(_.config.brokerId == 0) TestUtils.waitForPartitionMetadata(aliveServers, underMinIsrTopic, 0) - val output = TestUtils.grabConsoleOutput( - topicService.describeTopic(new TopicCommandOptions(Array("--under-min-isr-partitions")))) + var output = "" + TestUtils.waitUntilTrue( + () => { + output = TestUtils.grabConsoleOutput( + topicService.describeTopic(new TopicCommandOptions(Array("--under-min-isr-partitions")))) Review Comment: In fact, MetadataCache contains all information about topic partitions including isr, here we can change it like this: ``` TestUtils.waitUntilTrue( () => aliveServers.forall(broker => broker.metadataCache.getPartitionInfo(underMinIsrTopic, 0).get.isr().size() < 6 && broker.metadataCache.getPartitionInfo(offlineTopic, 0).isEmpty), "todo" ) ``` ########## core/src/test/scala/integration/kafka/admin/TopicCommandIntegrationTest.scala: ########## @@ -733,12 +733,18 @@ class TopicCommandIntegrationTest extends KafkaServerTestHarness with Logging wi killBroker(0) val aliveServers = brokers.filterNot(_.config.brokerId == 0) TestUtils.waitForPartitionMetadata(aliveServers, underMinIsrTopic, 0) - val output = TestUtils.grabConsoleOutput( - topicService.describeTopic(new TopicCommandOptions(Array("--under-min-isr-partitions")))) + var output = "" + TestUtils.waitUntilTrue( + () => { + output = TestUtils.grabConsoleOutput( + topicService.describeTopic(new TopicCommandOptions(Array("--under-min-isr-partitions")))) + 2 == output.split("\n").length + }, "Couldn't get topics with under-min-isr partitions" + ) val rows = output.split("\n") + assertEquals(2, rows.length) Review Comment: I'm not convinced about this, but both are OK, it doesn't matter. -- 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