YARN-4805. Don't go through all schedulers in ParameterizedTestBase. (kasha)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/49ff54c8 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/49ff54c8 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/49ff54c8 Branch: refs/heads/HDFS-7240 Commit: 49ff54c8609431f5d1a6bee84df3b52fec445379 Parents: 3a4ff77 Author: Karthik Kambatla <ka...@cloudera.com> Authored: Sat Mar 26 21:45:13 2016 -0700 Committer: Karthik Kambatla <ka...@cloudera.com> Committed: Sat Mar 26 21:45:13 2016 -0700 ---------------------------------------------------------------------- .../ParameterizedSchedulerTestBase.java | 36 ++++++-------------- .../yarn/server/resourcemanager/TestRM.java | 4 --- .../server/resourcemanager/TestRMRestart.java | 4 --- .../TestWorkPreservingRMRestart.java | 9 ----- .../reservation/TestReservationSystem.java | 4 --- .../scheduler/TestAbstractYarnScheduler.java | 6 ---- .../security/TestClientToAMTokens.java | 4 --- 7 files changed, 11 insertions(+), 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/49ff54c8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ParameterizedSchedulerTestBase.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ParameterizedSchedulerTestBase.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ParameterizedSchedulerTestBase.java index b099836..3f2bfc9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ParameterizedSchedulerTestBase.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ParameterizedSchedulerTestBase.java @@ -23,19 +23,13 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.Capacity import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration; - import org.junit.Before; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; -import java.util.Arrays; -import java.util.Collection; -@RunWith(Parameterized.class) public abstract class ParameterizedSchedulerTestBase { protected final static String TEST_DIR = new File(System.getProperty("test.build.data", "/tmp")).getAbsolutePath(); @@ -49,31 +43,23 @@ public abstract class ParameterizedSchedulerTestBase { CAPACITY, FAIR } - public ParameterizedSchedulerTestBase(SchedulerType type) { - schedulerType = type; - } - public YarnConfiguration getConf() { return conf; } - @Parameterized.Parameters - public static Collection<SchedulerType[]> getParameters() { - return Arrays.asList(new SchedulerType[][]{ - {SchedulerType.CAPACITY}, {SchedulerType.FAIR}}); - } - @Before - public void configureScheduler() throws IOException { + public void configureScheduler() throws IOException, ClassNotFoundException { conf = new YarnConfiguration(); - switch (schedulerType) { - case CAPACITY: - conf.set(YarnConfiguration.RM_SCHEDULER, - CapacityScheduler.class.getName()); - break; - case FAIR: - configureFairScheduler(conf); - break; + + Class schedulerClass = + conf.getClass(YarnConfiguration.RM_SCHEDULER, + Class.forName(YarnConfiguration.DEFAULT_RM_SCHEDULER)); + + if (schedulerClass == FairScheduler.class) { + schedulerType = SchedulerType.FAIR; + configureFairScheduler(conf); + } else if (schedulerClass == CapacityScheduler.class) { + schedulerType = SchedulerType.CAPACITY; } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/49ff54c8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java ---------------------------------------------------------------------- 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 77d8cdf..b04b173 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 @@ -91,10 +91,6 @@ public class TestRM extends ParameterizedSchedulerTestBase { private YarnConfiguration conf; - public TestRM(SchedulerType type) { - super(type); - } - @Before public void setup() { conf = getConf(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/49ff54c8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMRestart.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMRestart.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMRestart.java index 3057615..9606687 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMRestart.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMRestart.java @@ -136,10 +136,6 @@ public class TestRMRestart extends ParameterizedSchedulerTestBase { private static InetSocketAddress rmAddr; private List<MockRM> rms = new ArrayList<MockRM>(); - public TestRMRestart(SchedulerType type) { - super(type); - } - @Before public void setup() throws IOException { conf = getConf(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/49ff54c8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java index b32dfbf..370cbfe 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java @@ -89,7 +89,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.Dom import org.apache.hadoop.yarn.server.resourcemanager.security.DelegationTokenRenewer; import org.apache.hadoop.yarn.util.ControlledClock; import org.apache.hadoop.yarn.util.Records; -import org.apache.hadoop.yarn.util.SystemClock; import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator; import org.apache.hadoop.yarn.util.resource.ResourceCalculator; import org.apache.hadoop.yarn.util.resource.Resources; @@ -100,23 +99,15 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; import com.google.common.base.Supplier; - @SuppressWarnings({"rawtypes", "unchecked"}) -@RunWith(value = Parameterized.class) public class TestWorkPreservingRMRestart extends ParameterizedSchedulerTestBase { private YarnConfiguration conf; MockRM rm1 = null; MockRM rm2 = null; - public TestWorkPreservingRMRestart(SchedulerType type) { - super(type); - } - @Before public void setup() throws UnknownHostException { Logger rootLogger = LogManager.getRootLogger(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/49ff54c8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/TestReservationSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/TestReservationSystem.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/TestReservationSystem.java index 7fcf4bc..a7b7e32 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/TestReservationSystem.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/TestReservationSystem.java @@ -53,10 +53,6 @@ public class TestReservationSystem extends private Configuration conf; private RMContext mockRMContext; - public TestReservationSystem(SchedulerType type) { - super(type); - } - @Before public void setUp() throws IOException { scheduler = initializeScheduler(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/49ff54c8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestAbstractYarnScheduler.java ---------------------------------------------------------------------- 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/TestAbstractYarnScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestAbstractYarnScheduler.java index 81c8fe6..4042a29 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestAbstractYarnScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestAbstractYarnScheduler.java @@ -83,10 +83,6 @@ import org.mockito.Mockito; @SuppressWarnings("unchecked") public class TestAbstractYarnScheduler extends ParameterizedSchedulerTestBase { - public TestAbstractYarnScheduler(SchedulerType type) { - super(type); - } - @Test public void testMaximimumAllocationMemory() throws Exception { final int node1MaxMemory = 15 * 1024; @@ -268,7 +264,6 @@ public class TestAbstractYarnScheduler extends ParameterizedSchedulerTestBase { Resource configuredMaximumResource = Resource.newInstance (configuredMaxMemory, configuredMaxVCores); - configureScheduler(); YarnConfiguration conf = getConf(); conf.setInt(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, configuredMaxVCores); @@ -323,7 +318,6 @@ public class TestAbstractYarnScheduler extends ParameterizedSchedulerTestBase { Resource configuredMaximumResource = Resource.newInstance (configuredMaxMemory, configuredMaxVCores); - configureScheduler(); YarnConfiguration conf = getConf(); conf.setInt(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES, configuredMaxVCores); http://git-wip-us.apache.org/repos/asf/hadoop/blob/49ff54c8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestClientToAMTokens.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestClientToAMTokens.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestClientToAMTokens.java index 499b4d1..d36fb9f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestClientToAMTokens.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestClientToAMTokens.java @@ -84,10 +84,6 @@ import org.junit.Test; public class TestClientToAMTokens extends ParameterizedSchedulerTestBase { private YarnConfiguration conf; - public TestClientToAMTokens(SchedulerType type) { - super(type); - } - @Before public void setup() { conf = getConf();