From 7c325a5d7186b831b793df239600191601ec635f Mon Sep 17 00:00:00 2001 From: Bikas Saha Date: Sat, 23 Mar 2013 00:08:24 +0000 Subject: [PATCH] YARN-417. Addendum patch to fix broken test (Sandy Ryza via bikas) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1460064 13f79535-47bb-0310-9956-ffa450edef68 --- .../yarn/applications/distributedshell/ApplicationMaster.java | 4 ++++ .../unmanagedamlauncher/TestUnmanagedAMLauncher.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java index f51588a4dee..851bad584cf 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java @@ -394,6 +394,10 @@ public class ApplicationMaster { "container_memory", "10")); numTotalContainers = Integer.parseInt(cliParser.getOptionValue( "num_containers", "1")); + if (numTotalContainers == 0) { + throw new IllegalArgumentException( + "Cannot run distributed shell with no containers"); + } requestPriority = Integer.parseInt(cliParser .getOptionValue("priority", "0")); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/test/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/TestUnmanagedAMLauncher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/test/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/TestUnmanagedAMLauncher.java index 6bb863e9f07..3e6e126da1e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/test/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/TestUnmanagedAMLauncher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/test/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/TestUnmanagedAMLauncher.java @@ -91,7 +91,7 @@ public class TestUnmanagedAMLauncher { return envClassPath; } - @Test + @Test(timeout=10000) public void testDSShell() throws Exception { String classpath = getTestRuntimeClasspath(); String javaHome = System.getenv("JAVA_HOME"); @@ -110,7 +110,7 @@ public class TestUnmanagedAMLauncher { javaHome + "/bin/java -Xmx512m " + "org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster " - + "--container_memory 128 --num_containers 0 --priority 0 --shell_command ls" }; + + "--container_memory 128 --num_containers 1 --priority 0 --shell_command ls" }; LOG.info("Initializing Launcher"); UnmanagedAMLauncher launcher = new UnmanagedAMLauncher(new Configuration(