YARN-1078. TestNodeManagerResync, TestNodeManagerShutdown, and TestNodeStatusUpdater fail on Windows. Contributed by Chuan Liu.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1522644 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2013-09-12 15:58:34 +00:00
parent a202855af5
commit f152a7e788
3 changed files with 26 additions and 13 deletions

View File

@ -188,6 +188,9 @@ Release 2.1.1-beta - UNRELEASED
YARN-1176. RM web services ClusterMetricsInfo total nodes doesn't include YARN-1176. RM web services ClusterMetricsInfo total nodes doesn't include
unhealthy nodes (Jonathan Eagles via tgraves) unhealthy nodes (Jonathan Eagles via tgraves)
YARN-1078. TestNodeManagerResync, TestNodeManagerShutdown, and
TestNodeStatusUpdater fail on Windows. (Chuan Liu via cnauroth)
Release 2.1.0-beta - 2013-08-22 Release 2.1.0-beta - 2013-08-22
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.util.ArrayList; import java.util.ArrayList;
@ -163,7 +164,8 @@ public class TestNodeManagerShutdown {
ContainerLaunchContext containerLaunchContext = ContainerLaunchContext containerLaunchContext =
recordFactory.newRecordInstance(ContainerLaunchContext.class); recordFactory.newRecordInstance(ContainerLaunchContext.class);
NodeId nodeId = BuilderUtils.newNodeId("localhost", 12345); NodeId nodeId = BuilderUtils.newNodeId(InetAddress.getByName("localhost")
.getCanonicalHostName(), 12345);
URL localResourceUri = URL localResourceUri =
ConverterUtils.getYarnUrlFromPath(localFS ConverterUtils.getYarnUrlFromPath(localFS

View File

@ -23,7 +23,9 @@ import static org.mockito.Mockito.when;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -219,11 +221,11 @@ public class TestNodeStatusUpdater {
Resource resource = BuilderUtils.newResource(2, 1); Resource resource = BuilderUtils.newResource(2, 1);
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
String user = "testUser"; String user = "testUser";
ContainerTokenIdentifier containerToken = ContainerTokenIdentifier containerToken = BuilderUtils
BuilderUtils.newContainerTokenIdentifier(BuilderUtils .newContainerTokenIdentifier(BuilderUtils.newContainerToken(
.newContainerToken(firstContainerID, "localhost", 1234, user, firstContainerID, InetAddress.getByName("localhost")
resource, currentTime + 10000, 123, "password".getBytes(), .getCanonicalHostName(), 1234, user, resource,
currentTime)); currentTime + 10000, 123, "password".getBytes(), currentTime));
Container container = Container container =
new ContainerImpl(conf, mockDispatcher, launchContext, null, new ContainerImpl(conf, mockDispatcher, launchContext, null,
mockMetrics, containerToken); mockMetrics, containerToken);
@ -250,11 +252,11 @@ public class TestNodeStatusUpdater {
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
String user = "testUser"; String user = "testUser";
Resource resource = BuilderUtils.newResource(3, 1); Resource resource = BuilderUtils.newResource(3, 1);
ContainerTokenIdentifier containerToken = ContainerTokenIdentifier containerToken = BuilderUtils
BuilderUtils.newContainerTokenIdentifier(BuilderUtils .newContainerTokenIdentifier(BuilderUtils.newContainerToken(
.newContainerToken(secondContainerID, "localhost", 1234, user, secondContainerID, InetAddress.getByName("localhost")
resource, currentTime + 10000, 123, .getCanonicalHostName(), 1234, user, resource,
"password".getBytes(), currentTime)); currentTime + 10000, 123, "password".getBytes(), currentTime));
Container container = Container container =
new ContainerImpl(conf, mockDispatcher, launchContext, null, new ContainerImpl(conf, mockDispatcher, launchContext, null,
mockMetrics, containerToken); mockMetrics, containerToken);
@ -1290,9 +1292,15 @@ public class TestNodeStatusUpdater {
private YarnConfiguration createNMConfig() { private YarnConfiguration createNMConfig() {
YarnConfiguration conf = new YarnConfiguration(); YarnConfiguration conf = new YarnConfiguration();
String localhostAddress = null;
try {
localhostAddress = InetAddress.getByName("localhost").getCanonicalHostName();
} catch (UnknownHostException e) {
Assert.fail("Unable to get localhost address: " + e.getMessage());
}
conf.setInt(YarnConfiguration.NM_PMEM_MB, 5 * 1024); // 5GB conf.setInt(YarnConfiguration.NM_PMEM_MB, 5 * 1024); // 5GB
conf.set(YarnConfiguration.NM_ADDRESS, "localhost:12345"); conf.set(YarnConfiguration.NM_ADDRESS, localhostAddress + ":12345");
conf.set(YarnConfiguration.NM_LOCALIZER_ADDRESS, "localhost:12346"); conf.set(YarnConfiguration.NM_LOCALIZER_ADDRESS, localhostAddress + ":12346");
conf.set(YarnConfiguration.NM_LOG_DIRS, logsDir.getAbsolutePath()); conf.set(YarnConfiguration.NM_LOG_DIRS, logsDir.getAbsolutePath());
conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
remoteLogsDir.getAbsolutePath()); remoteLogsDir.getAbsolutePath());