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/03/02 12:27:27 UTC

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

symat commented on a change in pull request #1272: [ZOOKEEPER-3655] Remove localhost hardcoding from QuorumSSLTest on master
URL: https://github.com/apache/zookeeper/pull/1272#discussion_r386362763
 
 

 ##########
 File path: zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumSSLTest.java
 ##########
 @@ -122,7 +124,21 @@
     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:
   please use a logger to log exceptions.

----------------------------------------------------------------
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