YARN-7389. Make TestResourceManager Scheduler agnostic. (Robert Kanter via Haibo Chen)

(cherry picked from commit d7f3737f3b)
(cherry picked from commit 32a712a740)
This commit is contained in:
Haibo Chen 2017-10-24 22:17:56 -07:00 committed by Robert Kanter
parent 951d5a46f4
commit 955f3c30e4
1 changed files with 2 additions and 7 deletions

View File

@ -39,7 +39,7 @@ import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
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.AbstractYarnScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptRemovedSchedulerEvent;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent;
@ -58,8 +58,6 @@ public class TestResourceManager {
@Before
public void setUp() throws Exception {
Configuration conf = new YarnConfiguration();
conf.set(YarnConfiguration.RM_SCHEDULER,
CapacityScheduler.class.getCanonicalName());
UserGroupInformation.setConfiguration(conf);
resourceManager = new ResourceManager();
resourceManager.init(conf);
@ -133,6 +131,7 @@ public class TestResourceManager {
// Send a heartbeat to kick the tires on the Scheduler
nodeUpdate(nm1);
((AbstractYarnScheduler)resourceManager.getResourceScheduler()).update();
// Get allocations from the scheduler
application.schedule();
@ -262,8 +261,6 @@ public class TestResourceManager {
}
};
Configuration conf = new YarnConfiguration();
conf.set(YarnConfiguration.RM_SCHEDULER,
CapacityScheduler.class.getCanonicalName());
conf.set(filterInitializerConfKey, filterInitializer);
conf.set("hadoop.security.authentication", "kerberos");
conf.set("hadoop.http.authentication.type", "kerberos");
@ -298,8 +295,6 @@ public class TestResourceManager {
for (String filterInitializer : simpleFilterInitializers) {
resourceManager = new ResourceManager();
Configuration conf = new YarnConfiguration();
conf.set(YarnConfiguration.RM_SCHEDULER,
CapacityScheduler.class.getCanonicalName());
conf.set(filterInitializerConfKey, filterInitializer);
try {
UserGroupInformation.setConfiguration(conf);