YARN-557. Fix TestUnmanagedAMLauncher failure on Windows. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1465869 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-04-09 03:26:38 +00:00
parent b96d18bd23
commit 55865f42c4
4 changed files with 10 additions and 5 deletions

View File

@ -25,6 +25,9 @@ Trunk - Unreleased
YARN-491. TestContainerLogsPage fails on Windows. (Chris Nauroth via hitesh)
YARN-557. Fix TestUnmanagedAMLauncher failure on Windows. (Chris Nauroth via
vinodkv)
BREAKDOWN OF HADOOP-8562 SUBTASKS
YARN-158. Yarn creating package-info.java must not depend on sh.

View File

@ -103,7 +103,7 @@ public enum Environment {
* $USER
* Final, non-modifiable.
*/
USER("USER"),
USER(Shell.WINDOWS ? "USERNAME": "USER"),
/**
* $LOGNAME

View File

@ -683,7 +683,7 @@ public void run() {
ctx.setResource(container.getResource());
String jobUserName = System.getenv(ApplicationConstants.Environment.USER
.name());
.key());
ctx.setUser(jobUserName);
LOG.info("Setting user in ContainerLaunchContext to: " + jobUserName);

View File

@ -30,6 +30,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.MiniYARNCluster;
import org.junit.AfterClass;
@ -50,7 +51,7 @@ public static void setup() throws InterruptedException, IOException {
conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 128);
if (yarnCluster == null) {
yarnCluster = new MiniYARNCluster(
TestUnmanagedAMLauncher.class.getName(), 1, 1, 1);
TestUnmanagedAMLauncher.class.getSimpleName(), 1, 1, 1);
yarnCluster.init(conf);
yarnCluster.start();
URL url = Thread.currentThread().getContextClassLoader()
@ -93,7 +94,7 @@ private static String getTestRuntimeClasspath() {
return envClassPath;
}
@Test(timeout=10000)
@Test(timeout=30000)
public void testDSShell() throws Exception {
String classpath = getTestRuntimeClasspath();
String javaHome = System.getenv("JAVA_HOME");
@ -112,7 +113,8 @@ public void testDSShell() throws Exception {
javaHome
+ "/bin/java -Xmx512m "
+ "org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster "
+ "--container_memory 128 --num_containers 1 --priority 0 --shell_command ls" };
+ "--container_memory 128 --num_containers 1 --priority 0 "
+ "--shell_command " + (Shell.WINDOWS ? "dir" : "ls") };
LOG.info("Initializing Launcher");
UnmanagedAMLauncher launcher = new UnmanagedAMLauncher(new Configuration(