Use only loopback addresses in acceptance tests

Buggy builds of OpenJDK do not like hosts with very long host names,
and can crash in some environments. Diffy Cuckoo the Deckard based
auto-verifier for Gerrit on Google Compute Engine is unable to run
unit tests due to the JVM disliking the autoassigned host name.

Hardcode the loopback address for all unit tests.  This also
isolates tests from temporary IP address changes, e.g. roaming
between different WiFi networks.

Change-Id: Id462d5bc3dddcb3b761239bb2be44e3ccfd05f3f
This commit is contained in:
Shawn Pearce 2013-12-30 10:00:07 -08:00
parent 5d91ce959e
commit c2f0efb2d1

View File

@ -170,15 +170,7 @@ public class GerritServer {
}
private static InetAddress getLocalHost() throws UnknownHostException {
try {
return InetAddress.getLocalHost();
} catch (UnknownHostException e1) {
try {
return InetAddress.getByName("localhost");
} catch (UnknownHostException e2) {
return InetAddress.getByName("127.0.0.1");
}
}
return InetAddress.getLoopbackAddress();
}
private File sitePath;