Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8219585

[TESTBUG] sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java passes trivially when it shouldn't

XMLWordPrintable

    • b13
    • generic
    • generic

        The test has this comment:

         * NOTE:
         * This test requires at least a setup similar to the following in
         * /etc/hosts file (or the windows equivalent). I.e. it expects it to
         * be multi-homed and not both being the loop-back interface.
         * For example:
         * ----->8-------- /etc/hosts ----------->8---
         * 127.0.0.1 localhost
         * 192.168.0.1 localhost
         * ----->8-------- /etc/hosts ----------->8---

        However, when one configures the /etc/hosts file like the above the test still fails trivially with:

        Ignoring manual test since no more than one IPs are configured for 'localhost'

        As it turns out JDK-8145982 changed the original test by filtering out loopback interfaces from the interface list. The original logic used InetAddress.getAllByName("localhost") which included loopback addresses such as 127.0.0.1. The logic post JDK-8145982 does no longer.

        As a result the condition in the test's main method is wrong:

                List<InetAddress> addrs = getAddressesForLocalHost();
                if (addrs.size() < 2) {
                    System.out.println("Ignoring manual test since no more than one IPs are configured for 'localhost'");
                    return;
                }

        The condition should be addrs.size() < 1 rather than 2.

        The test needs at least two separate ip:port pairs to be able to bind to in order to not trivially pass. For example loop back address and the IP of the host should be sufficient.

              sgehwolf Severin Gehwolf
              sgehwolf Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: