|
@@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.nodemanager;
|
|
|
import static org.mockito.Mockito.mock;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.net.InetSocketAddress;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
@@ -35,6 +36,7 @@ import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.fs.FileContext;
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
|
|
+import org.apache.hadoop.net.NetUtils;
|
|
|
import org.apache.hadoop.yarn.YarnException;
|
|
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
|
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
|
@@ -88,7 +90,7 @@ public class TestNodeStatusUpdater {
|
|
|
int heartBeatID = 0;
|
|
|
volatile Throwable nmStartError = null;
|
|
|
private final List<NodeId> registeredNodes = new ArrayList<NodeId>();
|
|
|
- private final Configuration conf = new YarnConfiguration();
|
|
|
+ private final Configuration conf = createNMConfig();
|
|
|
private NodeManager nm;
|
|
|
protected NodeManager rebootedNodeManager;
|
|
|
|
|
@@ -117,7 +119,9 @@ public class TestNodeStatusUpdater {
|
|
|
Resource resource = request.getResource();
|
|
|
LOG.info("Registering " + nodeId.toString());
|
|
|
// NOTE: this really should be checking against the config value
|
|
|
- Assert.assertEquals("localhost:12345", nodeId.toString());
|
|
|
+ InetSocketAddress expected = NetUtils.getConnectAddress(
|
|
|
+ conf.getSocketAddr(YarnConfiguration.NM_ADDRESS, null, -1));
|
|
|
+ Assert.assertEquals(NetUtils.getHostPortString(expected), nodeId.toString());
|
|
|
Assert.assertEquals(5 * 1024, resource.getMemory());
|
|
|
registeredNodes.add(nodeId);
|
|
|
RegistrationResponse regResponse = recordFactory
|
|
@@ -429,6 +433,7 @@ public class TestNodeStatusUpdater {
|
|
|
while (nm.getServiceState() == STATE.INITED && waitCount++ != 20) {
|
|
|
LOG.info("Waiting for NM to start..");
|
|
|
if (nmStartError != null) {
|
|
|
+ LOG.error("Error during startup. ", nmStartError);
|
|
|
Assert.fail(nmStartError.getCause().getMessage());
|
|
|
}
|
|
|
Thread.sleep(1000);
|