|
@@ -30,6 +30,7 @@ import javax.naming.NameNotFoundException;
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
+import org.apache.hadoop.util.Shell;
|
|
|
import org.apache.hadoop.util.Time;
|
|
|
|
|
|
import org.junit.Test;
|
|
@@ -37,6 +38,7 @@ import org.junit.Test;
|
|
|
import static org.hamcrest.CoreMatchers.not;
|
|
|
import static org.hamcrest.core.Is.is;
|
|
|
import static org.junit.Assert.*;
|
|
|
+import static org.junit.Assume.assumeTrue;
|
|
|
|
|
|
/**
|
|
|
* Test host name and IP resolution and caching.
|
|
@@ -185,13 +187,17 @@ public class TestDNS {
|
|
|
*
|
|
|
* This test may fail on some misconfigured test machines that don't have
|
|
|
* an entry for "localhost" in their hosts file. This entry is correctly
|
|
|
- * configured out of the box on common Linux distributions, OS X and
|
|
|
- * Windows.
|
|
|
+ * configured out of the box on common Linux distributions and OS X.
|
|
|
+ *
|
|
|
+ * Windows refuses to resolve 127.0.0.1 to "localhost" despite the presence of
|
|
|
+ * this entry in the hosts file. We skip the test on Windows to avoid
|
|
|
+ * reporting a spurious failure.
|
|
|
*
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Test (timeout=60000)
|
|
|
public void testLookupWithHostsFallback() throws Exception {
|
|
|
+ assumeTrue(!Shell.WINDOWS);
|
|
|
final String oldHostname = changeDnsCachedHostname(DUMMY_HOSTNAME);
|
|
|
|
|
|
try {
|
|
@@ -231,7 +237,7 @@ public class TestDNS {
|
|
|
|
|
|
private String getLoopbackInterface() throws SocketException {
|
|
|
return NetworkInterface.getByInetAddress(
|
|
|
- InetAddress.getLoopbackAddress()).getDisplayName();
|
|
|
+ InetAddress.getLoopbackAddress()).getName();
|
|
|
}
|
|
|
|
|
|
/**
|