Nit: 
you may want to change this message 
           "Ignoring manual test since no more than one IPs are configured for 
'localhost'" 
to       "Ignoring manual test since no non loopback IPs are configured for 
'localhost'"


Thanks,
Sharath


-----Original Message-----
From: Severin Gehwolf [mailto:sgehw...@redhat.com] 
Sent: Friday, February 22, 2019 8:34 PM
To: serviceability-dev
Subject: RFR: 8219585: [TESTBUG] 
sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java passes 
trivially when it shouldn't

Hi!

Bug: https://bugs.openjdk.java.net/browse/JDK-8219585

Could somebody please review this trivial testbug. For a config like [1] the 
logic prior JDK-8145982 returned this list for
getAddressesForLocalHost():

[localhost/127.0.0.1, localhost/192.168.1.18, localhost/0:0:0:0:0:0:0:1]

Post JDK-8145982, getAddressesForLocalHost() returns:

[localhost/192.168.1.18]

The fix is trivial. Just adjust the condition for as to when the test should 
actually trivially pass:

diff --git 
a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java 
b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java
--- a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java
+++ b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTes
+++ t.java
@@ -176,8 +176,8 @@
     }
 
     public static void main(String[] args) {
-        List<InetAddress> addrs = getAddressesForLocalHost();
-        if (addrs.size() < 2) {
+        List<InetAddress> addrs = getNonLoopbackAddressesForLocalHost();
+        if (addrs.size() < 1) {
             System.out.println("Ignoring manual test since no more than one 
IPs are configured for 'localhost'");
             return;
         }
@@ -186,7 +186,7 @@
         System.out.println("All tests PASSED.");
     }
 
-    private static List<InetAddress> getAddressesForLocalHost() {
+    private static List<InetAddress> 
+ getNonLoopbackAddressesForLocalHost() {
 
         try {
             return NetworkInterface.networkInterfaces()


Testing: Manual testing on local setup. jdk/submit (currently running)

Thanks,
Severin


[1] $ grep localhost /etc/hosts | grep -v '::'
127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.1.18 localhost

Reply via email to