On Wed, Mar 13, 2019 at 11:24 AM Daniel Fuchs <daniel.fu...@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!