From 1e1200d594e681c441cf8442d0329bbb9938a77b Mon Sep 17 00:00:00 2001 From: Karthik Kambatla Date: Wed, 9 Apr 2014 05:49:24 +0000 Subject: [PATCH] YARN-1784. TestContainerAllocation assumes CapacityScheduler. (Robert Kanter via kasha) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1585894 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../capacity/TestContainerAllocation.java | 16 ++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 3c93d816b4..ba7c3e6cf9 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -65,6 +65,9 @@ Release 2.5.0 - UNRELEASED YARN-1790. Fair Scheduler UI not showing apps table (bc Wong via Sandy Ryza) + YARN-1784. TestContainerAllocation assumes CapacityScheduler. + (Robert Kanter via kasha) + Release 2.4.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestContainerAllocation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestContainerAllocation.java index 8a37fe932d..853b4c3d74 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestContainerAllocation.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestContainerAllocation.java @@ -48,6 +48,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerState; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager; +import org.junit.Before; import org.junit.Test; @@ -57,9 +58,17 @@ public class TestContainerAllocation { private final int GB = 1024; + private YarnConfiguration conf; + + @Before + public void setUp() throws Exception { + conf = new YarnConfiguration(); + conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class, + ResourceScheduler.class); + } + @Test(timeout = 3000000) public void testExcessReservationThanNodeManagerCapacity() throws Exception { - YarnConfiguration conf = new YarnConfiguration(); MockRM rm = new MockRM(conf); rm.start(); @@ -129,9 +138,6 @@ public void testExcessReservationThanNodeManagerCapacity() throws Exception { // acquired by the AM, not when the containers are allocated @Test public void testContainerTokenGeneratedOnPullRequest() throws Exception { - YarnConfiguration conf = new YarnConfiguration(); - conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class, - ResourceScheduler.class); MockRM rm1 = new MockRM(conf); rm1.start(); MockNM nm1 = rm1.registerNode("127.0.0.1:1234", 8000); @@ -161,7 +167,6 @@ public void testContainerTokenGeneratedOnPullRequest() throws Exception { @Test public void testNormalContainerAllocationWhenDNSUnavailable() throws Exception{ - YarnConfiguration conf = new YarnConfiguration(); MockRM rm1 = new MockRM(conf); rm1.start(); MockNM nm1 = rm1.registerNode("unknownhost:1234", 8000); @@ -218,7 +223,6 @@ public Token createContainerToken(ContainerId containerId, // creation failure. @Test(timeout = 20000) public void testAMContainerAllocationWhenDNSUnavailable() throws Exception { - final YarnConfiguration conf = new YarnConfiguration(); MockRM rm1 = new MockRM(conf) { @Override protected RMSecretManagerService createRMSecretManagerService() {