You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by li...@apache.org on 2025/10/09 17:56:09 UTC

(kafka) branch trunk updated: MINOR: changed the condition to only check the test topic to reduce the flakiness of the test. (#20664)

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

lianetm 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 6ef10ec75d2 MINOR: changed the condition to only check the test topic to reduce the flakiness of the test. (#20664)
6ef10ec75d2 is described below

commit 6ef10ec75d2ffceabaf643eb696986140c5b1bfe
Author: Nikita Shupletsov <ni...@shupletsov.ca>
AuthorDate: Thu Oct 9 10:56:03 2025 -0700

    MINOR: changed the condition to only check the test topic to reduce the flakiness of the test. (#20664)
    
    MINOR: changed the condition to only check the test topic to reduce the
    flakiness of the test.
    
    Reviewers: Matthias J. Sax <ma...@confluent.io>, Lianet Magrans
     <lm...@confluent.io>
---
 tools/src/test/java/org/apache/kafka/tools/TopicCommandTest.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/src/test/java/org/apache/kafka/tools/TopicCommandTest.java b/tools/src/test/java/org/apache/kafka/tools/TopicCommandTest.java
index c6f1073edb5..57a8269f089 100644
--- a/tools/src/test/java/org/apache/kafka/tools/TopicCommandTest.java
+++ b/tools/src/test/java/org/apache/kafka/tools/TopicCommandTest.java
@@ -1192,14 +1192,15 @@ public class TopicCommandTest {
             // describe the topic and test if it's under-replicated
             String simpleDescribeOutput = captureDescribeTopicStandardOut(clusterInstance, buildTopicCommandOptionsWithBootstrap(clusterInstance, "--describe", "--topic", testTopicName));
             String[] simpleDescribeOutputRows = simpleDescribeOutput.split(System.lineSeparator());
-            assertTrue(simpleDescribeOutputRows[0].startsWith(String.format("Topic: %s", testTopicName)),
+            String testTopicNameLogLine = String.format("Topic: %s", testTopicName);
+            assertTrue(simpleDescribeOutputRows[0].startsWith(testTopicNameLogLine),
                     "Unexpected describe output: " + simpleDescribeOutputRows[0]);
             assertEquals(2, simpleDescribeOutputRows.length,
                     "Unexpected describe output length: " + simpleDescribeOutputRows.length);
 
             String underReplicatedOutput = captureDescribeTopicStandardOut(clusterInstance, buildTopicCommandOptionsWithBootstrap(clusterInstance, "--describe", "--under-replicated-partitions"));
-            assertEquals("", underReplicatedOutput,
-                    String.format("--under-replicated-partitions shouldn't return anything: '%s'", underReplicatedOutput));
+            assertFalse(underReplicatedOutput.contains(testTopicNameLogLine),
+                    String.format("--under-replicated-partitions shouldn't contain '%s': '%s'", testTopicNameLogLine, underReplicatedOutput));
 
             int maxRetries = 20;
             long pause = 100L;