|
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.mock;
|
|
|
import static org.mockito.Mockito.when;
|
|
|
|
|
|
import java.util.Collection;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.EnumSet;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.Map;
|
|
@@ -33,6 +34,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationId;
|
|
|
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
|
|
|
import org.apache.hadoop.yarn.api.records.Container;
|
|
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
|
|
+import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
|
|
|
import org.apache.hadoop.yarn.api.records.ContainerState;
|
|
|
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
|
|
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
|
@@ -118,6 +120,11 @@ public class TestSystemMetricsPublisher {
|
|
|
when(asc.getUnmanagedAM()).thenReturn(false);
|
|
|
when(asc.getPriority()).thenReturn(Priority.newInstance(1));
|
|
|
when(asc.getNodeLabelExpression()).thenReturn("high-cpu");
|
|
|
+ ContainerLaunchContext containerLaunchContext =
|
|
|
+ mock(ContainerLaunchContext.class);
|
|
|
+ when(containerLaunchContext.getCommands())
|
|
|
+ .thenReturn(Collections.singletonList("java -Xmx1024m"));
|
|
|
+ when(asc.getAMContainerSpec()).thenReturn(containerLaunchContext);
|
|
|
when(app.getApplicationSubmissionContext()).thenReturn(asc);
|
|
|
metricsPublisher.appUpdated(app, 4L);
|
|
|
} else {
|
|
@@ -197,6 +204,12 @@ public class TestSystemMetricsPublisher {
|
|
|
Assert.assertEquals("uers1,user2",
|
|
|
entity.getOtherInfo().get(
|
|
|
ApplicationMetricsConstants.APP_VIEW_ACLS_ENTITY_INFO));
|
|
|
+
|
|
|
+ Assert.assertEquals(
|
|
|
+ app.getApplicationSubmissionContext().getAMContainerSpec()
|
|
|
+ .getCommands(),
|
|
|
+ entity.getOtherInfo()
|
|
|
+ .get(ApplicationMetricsConstants.AM_CONTAINER_LAUNCH_COMMAND));
|
|
|
} else {
|
|
|
Assert.assertEquals(
|
|
|
"",
|
|
@@ -492,6 +505,11 @@ public class TestSystemMetricsPublisher {
|
|
|
when(asc.getUnmanagedAM()).thenReturn(false);
|
|
|
when(asc.getPriority()).thenReturn(Priority.newInstance(10));
|
|
|
when(asc.getNodeLabelExpression()).thenReturn("high-cpu");
|
|
|
+ ContainerLaunchContext containerLaunchContext =
|
|
|
+ mock(ContainerLaunchContext.class);
|
|
|
+ when(containerLaunchContext.getCommands())
|
|
|
+ .thenReturn(Collections.singletonList("java -Xmx1024m"));
|
|
|
+ when(asc.getAMContainerSpec()).thenReturn(containerLaunchContext);
|
|
|
when(app.getApplicationSubmissionContext()).thenReturn(asc);
|
|
|
when(app.getAppNodeLabelExpression()).thenCallRealMethod();
|
|
|
ResourceRequest amReq = mock(ResourceRequest.class);
|