You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/01/02 21:43:20 UTC

[GitHub] [zookeeper] kishorvpatil commented on a change in pull request #1188: [ZOOKEEPER-3655] Remove localhost hardcoding from QuorumSSLTest

kishorvpatil commented on a change in pull request #1188: [ZOOKEEPER-3655] Remove localhost hardcoding from QuorumSSLTest
URL: https://github.com/apache/zookeeper/pull/1188#discussion_r362641153
 
 

 ##########
 File path: zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumSSLTest.java
 ##########
 @@ -122,10 +124,26 @@
     private static final String PORT_UNIFICATION_DISABLED = "portUnification=false\n";
 
     private static final char[] PASSWORD = "testpass".toCharArray();
-    private static final String HOSTNAME = "localhost";
+
+    private static String HOSTNAME;
+    private static String ipAddress;
+
+    {
+        InetAddress address = null;
+        try {
+            address = InetAddress.getLocalHost();
+            HOSTNAME = address.getHostName();
+            ipAddress = address.getHostAddress();
+        } catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
 
 Review comment:
   @maoling , The test fails if /etc/hosts has ipv6 because localhost or ip address is hardcoded in the tests. The change makes it agostic to host setup.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services