HADOOP-12542. TestDNS fails on Windows after HADOOP-12437. Contributed by Chris Nauroth.

(cherry picked from commit 957f0311a1)
This commit is contained in:
cnauroth 2015-11-02 22:25:05 -08:00
parent fd9a7f84bc
commit afff29113a
2 changed files with 11 additions and 3 deletions

View File

@ -705,6 +705,8 @@ Release 2.8.0 - UNRELEASED
HADOOP-12508. delete fails with exception when lease is held on blob.
(Gaurav Kanade via cnauroth)
HADOOP-12542. TestDNS fails on Windows after HADOOP-12437. (cnauroth)
OPTIMIZATIONS
HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()

View File

@ -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();
}
/**