From 8f214dc4f8423250947a3f0027f70b9ab402ab62 Mon Sep 17 00:00:00 2001 From: Haibo Chen Date: Mon, 6 Nov 2017 15:45:37 -0800 Subject: [PATCH] YARN-7360. TestRM.testNMTokenSentForNormalContainer() should be scheduler agnostic. --- .../hadoop/yarn/server/resourcemanager/TestRM.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java index f912f68e910..36793190315 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java @@ -21,7 +21,7 @@ package org.apache.hadoop.yarn.server.resourcemanager; import com.google.common.base.Supplier; import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.yarn.event.DrainDispatcher; -import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; import org.junit.Before; import static org.mockito.Matchers.argThat; import static org.mockito.Mockito.doNothing; @@ -73,7 +73,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptE import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEventType; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; -import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM; import org.apache.log4j.Level; @@ -205,8 +204,6 @@ public class TestRM extends ParameterizedSchedulerTestBase { // corresponding NM Token. @Test (timeout = 20000) public void testNMTokenSentForNormalContainer() throws Exception { - conf.set(YarnConfiguration.RM_SCHEDULER, - CapacityScheduler.class.getCanonicalName()); MockRM rm = new MockRM(conf); rm.start(); MockNM nm1 = rm.registerNode("h1:1234", 5120); @@ -215,8 +212,10 @@ public class TestRM extends ParameterizedSchedulerTestBase { // Call getNewContainerId to increase container Id so that the AM container // Id doesn't equal to one. - CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler(); - cs.getApplicationAttempt(attempt.getAppAttemptId()).getNewContainerId(); + AbstractYarnScheduler scheduler = (AbstractYarnScheduler) + rm.getResourceScheduler(); + scheduler.getApplicationAttempt(attempt.getAppAttemptId()). + getNewContainerId(); MockAM am = MockRM.launchAM(app, rm, nm1); // am container Id not equal to 1.