Regarding 8220575: Correctly format test URI's that contain a retrieved IPv6 address
Martin Buchholz
martinrb at google.com
Thu Mar 14 01:45:47 UTC 2019
On Wed, Mar 13, 2019 at 11:24 AM Daniel Fuchs <daniel.fuchs at oracle.com>
wrote:
>
> jshell> InetAddress.getLoopbackAddress().getHostName()
> $7 ==> "localhost"
>
> jshell> InetAddress.getAllByName("localhost");
> $8 ==> InetAddress[3] {
> localhost/127.0.0.1,
> localhost/0:0:0:0:0:0:0:1,
> localhost/fe80:0:0:0:0:0:0:1%1
> }
>
Thanks for that lesson - TIL.
Despite being unfamiliar with networking code and test machines at Oracle,
I suggest:
- misconfigured test machines that don't work with their advertised
interfaces is unacceptable - just fix them!
- tests that don't care much about which loopback connection they get could
choose one randomly, via a test library method. I like this sort of test
randomness, despite the possible flakiness.
- for tests where you do want coverage of both ipv4 and ipv6 interfaces, it
seems best to loop over all the available ones.
- I think "localhost" is more than a convention - it's a standard, but is
it recommended in tests to use
InetAddress.getLoopbackAddress().getHostName() instead of hardcoded
"localhost"?
I know test engineering is hard work!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190313/15dcc1eb/attachment-0001.html>
More information about the net-dev
mailing list