On Mon, 3 Mar 2025 12:49:30 GMT, Jaikiran Pai <[email protected]> wrote:
>> SendaoYan has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Remove "@build jtreg.SkippedException"
>
> test/jdk/java/net/InetAddress/IsReachableViaLoopbackTest.java line 63:
>
>> 61: } catch (java.net.UnknownHostException e) {
>> 62: e.printStackTrace();
>> 63: throw new SkippedException("Network setup issue");
>
> I am wondering for tests like these two whether we should introduce a JDK
> specific `@key` (in `TEST.ROOT`) https://openjdk.org/jtreg/tag-spec.html and
> then have these 2 tests use that key to indicate that these tests require an
> external connection. That way, when launching jtreg you can specify that it
> skip executing these tests based on that key name.
>
> Daniel, Aleksei, would there be some other better way to deal with this?
I wouldn't be surprised to see this test randomly fail with
`RuntimeException(remoteAddr + " is reachable")` on some configurations as it
depends on how "`localhost"` gets resolved on the local machine (even if that's
another issue). AFAICS it's trying to test that remote addresses are not
reachable from the loopback. But `InetAddress.getByName("localhost")` may not
always return the loopback. Using `InetAddress.getLoopbackAddress()` would be
more robust. And maybe we could use `getByAddress()` instead of `getByName()`
for the remote address, which would avoid the UnknownHostException?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23767#discussion_r1977611349