You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ch...@apache.org on 2026/04/14 05:42:20 UTC

(kafka) branch trunk updated: MINOR: Flaky test fixes (#21986)

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

chia7712 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 4acdac697cb MINOR: Flaky test fixes (#21986)
4acdac697cb is described below

commit 4acdac697cb568a7a79b1cc04fb2f769815f025e
Author: Andrew Schofield <as...@confluent.io>
AuthorDate: Tue Apr 14 06:42:13 2026 +0100

    MINOR: Flaky test fixes (#21986)
    
    Fixes a couple of flaky tests.
    
    Reviewers: Chia-Ping Tsai <ch...@gmail.com>, Apoorv Mittal
     <ap...@gmail.com>
---
 .../java/org/apache/kafka/tools/LeaderElectionCommandErrorTest.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/src/test/java/org/apache/kafka/tools/LeaderElectionCommandErrorTest.java b/tools/src/test/java/org/apache/kafka/tools/LeaderElectionCommandErrorTest.java
index 46942be75f3..a80a781158c 100644
--- a/tools/src/test/java/org/apache/kafka/tools/LeaderElectionCommandErrorTest.java
+++ b/tools/src/test/java/org/apache/kafka/tools/LeaderElectionCommandErrorTest.java
@@ -88,9 +88,11 @@ public class LeaderElectionCommandErrorTest {
 
     @Test
     public void testInvalidBroker() {
+        // Use RFC 5737 TEST-NET-1 (192.0.2.0/24) - a non-routable address reserved for
+        // documentation and testing. This address guarantees a connection timeout.
         Throwable e = assertThrows(AdminCommandFailedException.class, () -> LeaderElectionCommand.run(
             Duration.ofSeconds(1),
-            "--bootstrap-server", "example.com:1234",
+            "--bootstrap-server", "192.0.2.1:9092",
             "--election-type", "unclean",
             "--all-topic-partitions"
         ));