On Mon, Jan 26, 2015 at 8:45 AM, Oleg Kalnichevski <[email protected]> wrote:
> On Mon, 2015-01-26 at 08:03 -0500, Gary Gregory wrote: > > On Mon, Jan 26, 2015 at 4:11 AM, Oleg Kalnichevski <[email protected]> > wrote: > > > > > On Sat, 2015-01-24 at 14:33 -0500, Gary Gregory wrote: > > > > Running 'mvn test' I get: > > > > > > > > Failed tests: > > > > TestHttpRoute.testTargetHostNormalizationAddress:619 > > > > expected:<[localhost]> but was:<[127.0.0.1]> > > > > > > > > Using: > > > > > > > > > > Gary > > > > > > This is clearly not a defect, but what appears to be Windows specific > > > behavior. > > > > > > > If you say so, I am only testing on Windows. There is no way for me to > know > > or tell that this is Windows specific. I see you removed: > > > > Assert.assertEquals("localhost", targetHost.getHostName()); > > > > If this is expected to pass on non-Windows then perhaps the assert should > > be in a special test method with a JUnit Assume that only passes on > > non-Windows. > > > > Or is the behavior of the method "underfined" WRT to 'transformations'? > > > > Did the behavior change between releases? Is this going to be a > > compatibility issue? > > > > I do not think so. The problem stems from platform dependent results of > resolving 127.0.0.1 to a host name. Unix-like OSes resolve this address > to 'localhost' whereas Windows resolves it to '127.0.0.1'. > Thank you for the explanation. This: public class IpToHostName { public static void main(String[] args) { for (int i = 0; i < args.length; i++) { InetAddress addr; try { String addrStr = args[i]; addr = InetAddress.getByName(addrStr); String host = addr.getHostName(); System.out.println(String.format("%s -> %s", addrStr, host)); } catch (UnknownHostException e) { e.printStackTrace(); } } } } With input 127.0.0.1 produces 127.0.0.1 -> 127.0.0.1 Lovely. So we are stuck with this behavior and the test does not know about this quirk and fails. Bleh. I only feel good about +'ing a src zip for an RC I can build, so I will not vote. If creating RC's were not such a pain... If this RC becomes a release, then a note on the site must talk about this as an expected build failure on Windows IMO. Gary > > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- E-Mail: [email protected] | [email protected] Java Persistence with Hibernate, Second Edition <http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
