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

(cherry picked from commit 95694b70cd)
This commit is contained in:
Jason Lowe 2017-10-03 14:44:04 -05:00
parent 4540cbb3a0
commit 3629c95c51
2 changed files with 7 additions and 3 deletions

View File

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

View File

@ -142,7 +142,7 @@ public class TestLinuxContainerExecutorWithMocks {
tmpMockExecutor = System.getProperty("test.build.data") +
"/tmp-mock-container-executor";
Configuration conf = new Configuration();
Configuration conf = new YarnConfiguration();
LinuxContainerRuntime linuxContainerRuntime;
LinuxContainerRuntime mockLinuxContainerRuntime;
@ -236,7 +236,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());
}
@ -259,7 +262,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" );