You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by sy...@apache.org on 2020/10/24 13:19:29 UTC

[zookeeper] branch master updated: ZOOKEEPER-3981: Flaky test MultipleAddressTest::testGetValidAddressWithNotValid

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

symat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 3ff30a6  ZOOKEEPER-3981: Flaky test MultipleAddressTest::testGetValidAddressWithNotValid
3ff30a6 is described below

commit 3ff30a6427fdc2f13e60ff530800eca55ff02c9a
Author: Michael Han <ha...@apache.org>
AuthorDate: Sat Oct 24 13:18:10 2020 +0000

    ZOOKEEPER-3981: Flaky test MultipleAddressTest::testGetValidAddressWithNotValid
    
    Problem:
    
    Test MultipleAddressTest::testGetValidAddressWithNotValid might fail deterministically when the address it's using, 10.0.0.1, is reachable, as per https://tools.ietf.org/html/rfc5735 10.0.0.1 might be allocatable to private network usage. In fact, the router address of my ISP is assigned this IP, leading to this test always failing for me.
    
    Solution:
    
    Replace the address with 240.0.0.0, which is reserved for future use and less likely to be reachable.
    
    Author: Michael Han <mi...@lianghan.org>
    Author: Michael Han <ha...@apache.org>
    
    Reviewers: Christopher Tubbs <ct...@apache.org>, Mate Szalay-Beko <sy...@apache.org>
    
    Closes #1511 from hanm/fixut
---
 .../org/apache/zookeeper/server/quorum/MultipleAddressesTest.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/MultipleAddressesTest.java b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/MultipleAddressesTest.java
index bf86ce0..498f5f0 100644
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/MultipleAddressesTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/MultipleAddressesTest.java
@@ -110,7 +110,8 @@ public class MultipleAddressesTest {
     @Test
     public void testGetValidAddressWithNotValid() {
         assertThrows(NoRouteToHostException.class, () -> {
-            MultipleAddresses multipleAddresses = new MultipleAddresses(new InetSocketAddress("10.0.0.1", 22));
+            // IP chosen because it is reserved for documentation/examples and should be unreachable (RFC 5737)
+            MultipleAddresses multipleAddresses = new MultipleAddresses(new InetSocketAddress("203.0.113.1", 22));
             multipleAddresses.getReachableAddress();
         });
     }
@@ -259,4 +260,4 @@ public class MultipleAddressesTest {
                 .mapToObj(i -> "127.0.0." + i).collect(Collectors.toList());
     }
 
-}
\ No newline at end of file
+}