This is an automated email from the ASF dual-hosted git repository.

showuon pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6ab4d047d56 MINOR: Fix flaky testDescribeUnderReplicatedPartitions 
(#12112)
6ab4d047d56 is described below

commit 6ab4d047d563e0fe42a7c0ed6f10ddecda135595
Author: dengziming <[email protected]>
AuthorDate: Thu May 12 20:55:42 2022 +0800

    MINOR: Fix flaky testDescribeUnderReplicatedPartitions (#12112)
    
    Currently, we are waiting for metadataCache to bookkeeper the partition 
info, this isn't enough, we should wait until the partition ISR is less than AR.
    
    Reviewers: Luke Chen <[email protected]>, Divij Vaidya 
<[email protected]>
---
 .../kafka/admin/TopicCommandIntegrationTest.scala           | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/core/src/test/scala/integration/kafka/admin/TopicCommandIntegrationTest.scala 
b/core/src/test/scala/integration/kafka/admin/TopicCommandIntegrationTest.scala
index 99b2f3e0b7f..ad2b74f6e2c 100644
--- 
a/core/src/test/scala/integration/kafka/admin/TopicCommandIntegrationTest.scala
+++ 
b/core/src/test/scala/integration/kafka/admin/TopicCommandIntegrationTest.scala
@@ -586,11 +586,20 @@ class TopicCommandIntegrationTest extends 
KafkaServerTestHarness with Logging wi
     try {
       killBroker(0)
       val aliveServers = brokers.filterNot(_.config.brokerId == 0)
-      TestUtils.waitForPartitionMetadata(aliveServers, testTopicName, 0)
+
+      if (isKRaftTest()) {
+        TestUtils.ensureConsistentKRaftMetadata(
+          aliveServers,
+          controllerServer,
+          "Timeout waiting for partition metadata propagating to brokers"
+        )
+      } else {
+        TestUtils.waitForPartitionMetadata(aliveServers, testTopicName, 0)
+      }
       val output = TestUtils.grabConsoleOutput(
         topicService.describeTopic(new 
TopicCommandOptions(Array("--under-replicated-partitions"))))
       val rows = output.split("\n")
-      assertTrue(rows(0).startsWith(s"\tTopic: $testTopicName"))
+      assertTrue(rows(0).startsWith(s"\tTopic: $testTopicName"), s"Unexpected 
output: ${rows(0)}")
     } finally {
       restartDeadBrokers()
     }

Reply via email to