RFR: JDK-8314517: some tests fail in case ipv6 is disabled on the machine
Daniel Fuchs
dfuchs at openjdk.org
Mon Aug 21 17:35:26 UTC 2023
On Mon, 21 Aug 2023 07:35:19 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Some jtreg tests fail with ipv6 disabled on the machine, this should be improved in the tests (e.g. by using IPSupport.hasIPv6() ).
>
> test/jdk/java/net/InetAddress/HostsFileOrderingTest.java line 91:
>
>> 89: @Test
>> 90: public void testOrdering() throws Exception {
>> 91: if (IPSupport.hasIPv6()) {
>
> Hello Matthias, unlike changes to some other tests, this skips the entire test method if there's no IPv6 support. So perhaps add a System.out message that this test is skipped? I checked if `testng` has `assumeTrue` kind of API like junit, but I couldn't find any, so just returning by printing a System.out message might be enough.
Some of the test runs should work whether the machine has IPv6 or not. Maybe this test should be more selective with respect to when the test should be skipped. For instance at line 47-48:
* @run testng/othervm -Djdk.net.hosts.file=TestHostsFile.txt
* -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false HostsFileOrderingTest
well - that should work - and only return IPv4 addresses.
On second thought - I suspect it's `getExpectedAddressesArray()` that should be fixed to take into account IPSupport.hasIPv6() instead of doing it here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15341#discussion_r1300440236
More information about the net-dev
mailing list