YARN-5444. Fix failing unit tests in TestLinuxContainerExecutorWithMocks. Contributed by Yufei Gu.

This commit is contained in:
Varun Vasudev 2016-08-01 16:00:17 +05:30
parent 770b5eb2db
commit 95694b70cd
2 changed files with 7 additions and 3 deletions

View File

@ -97,6 +97,7 @@ public class LinuxContainerExecutor extends ContainerExecutor {
resourcesHandler = getResourcesHandler(conf);
containerSchedPriorityIsSet = false;
if (conf.get(YarnConfiguration.NM_CONTAINER_EXECUTOR_SCHED_PRIORITY)
!= null) {
containerSchedPriorityIsSet = true;

View File

@ -128,7 +128,7 @@ public class TestLinuxContainerExecutorWithMocks {
tmpMockExecutor = System.getProperty("test.build.data") +
"/tmp-mock-container-executor";
Configuration conf = new Configuration();
Configuration conf = new YarnConfiguration();
LinuxContainerRuntime linuxContainerRuntime;
setupMockExecutor(MOCK_EXECUTOR, conf);
@ -220,7 +220,10 @@ public class TestLinuxContainerExecutorWithMocks {
public void testLaunchCommandWithoutPriority() throws IOException {
// make sure the command doesn't contain the nice -n since priority
// not specified
List<String> command = new ArrayList<String>();
List<String> command = new ArrayList<String>();
Configuration conf = mockExec.getConf();
conf.unset(YarnConfiguration.NM_CONTAINER_EXECUTOR_SCHED_PRIORITY);
mockExec.setConf(conf);
mockExec.addSchedPriorityCommand(command);
assertEquals("addSchedPriority should be empty", 0, command.size());
}
@ -243,7 +246,7 @@ public class TestLinuxContainerExecutorWithMocks {
.build());
List<String> result=readMockParams();
Assert.assertEquals(result.size(), 18);
Assert.assertEquals(result.size(), 19);
Assert.assertEquals(result.get(0), YarnConfiguration.DEFAULT_NM_NONSECURE_MODE_LOCAL_USER);
Assert.assertEquals(result.get(1), "test");
Assert.assertEquals(result.get(2), "0" );