From 3af3b0bda9ac199da42b7e8cc94711441a6ec105 Mon Sep 17 00:00:00 2001 From: Zhijie Shen Date: Wed, 26 Mar 2014 21:18:38 +0000 Subject: [PATCH] YARN-1873. Fixed TestDistributedShell failure when the test cases are out of order. Contributed by Mit Desai. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1582060 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../TestDistributedShell.java | 21 ++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index b40a3d4ad5f..269d615fb84 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -585,6 +585,9 @@ Release 2.4.0 - UNRELEASED ResourceTrackerProtocol so that they work in HA scenario. (Xuan Gong via jianhe) + YARN-1873. Fixed TestDistributedShell failure when the test cases are out of + order. (Mit Desai via zjshen) + Release 2.3.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java index ccee8583e98..c3d676f679d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java @@ -51,8 +51,8 @@ import org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerManagerImpl; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.After; +import org.junit.Before; import org.junit.Test; public class TestDistributedShell { @@ -60,13 +60,14 @@ public class TestDistributedShell { private static final Log LOG = LogFactory.getLog(TestDistributedShell.class); - protected static MiniYARNCluster yarnCluster = null; - protected static Configuration conf = new YarnConfiguration(); + protected MiniYARNCluster yarnCluster = null; + protected Configuration conf = new YarnConfiguration(); - protected static String APPMASTER_JAR = JarFinder.getJar(ApplicationMaster.class); + protected final static String APPMASTER_JAR = + JarFinder.getJar(ApplicationMaster.class); - @BeforeClass - public static void setup() throws Exception { + @Before + public void setup() throws Exception { LOG.info("Starting up YARN cluster"); conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 128); conf.setClass(YarnConfiguration.RM_SCHEDULER, @@ -106,11 +107,11 @@ public static void setup() throws Exception { Thread.sleep(2000); } catch (InterruptedException e) { LOG.info("setup thread sleep interrupted. message=" + e.getMessage()); - } + } } - @AfterClass - public static void tearDown() throws IOException { + @After + public void tearDown() throws IOException { if (yarnCluster != null) { try { yarnCluster.stop();