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-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 BREAKDOWN OF HADOOP-8562 SUBTASKS
YARN-158. Yarn creating package-info.java must not depend on sh. YARN-158. Yarn creating package-info.java must not depend on sh.

View File

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

View File

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

View File

@ -30,6 +30,7 @@ import junit.framework.Assert;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.MiniYARNCluster; import org.apache.hadoop.yarn.server.MiniYARNCluster;
import org.junit.AfterClass; import org.junit.AfterClass;
@ -50,7 +51,7 @@ public class TestUnmanagedAMLauncher {
conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 128); conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 128);
if (yarnCluster == null) { if (yarnCluster == null) {
yarnCluster = new MiniYARNCluster( yarnCluster = new MiniYARNCluster(
TestUnmanagedAMLauncher.class.getName(), 1, 1, 1); TestUnmanagedAMLauncher.class.getSimpleName(), 1, 1, 1);
yarnCluster.init(conf); yarnCluster.init(conf);
yarnCluster.start(); yarnCluster.start();
URL url = Thread.currentThread().getContextClassLoader() URL url = Thread.currentThread().getContextClassLoader()
@ -93,7 +94,7 @@ public class TestUnmanagedAMLauncher {
return envClassPath; return envClassPath;
} }
@Test(timeout=10000) @Test(timeout=30000)
public void testDSShell() throws Exception { public void testDSShell() throws Exception {
String classpath = getTestRuntimeClasspath(); String classpath = getTestRuntimeClasspath();
String javaHome = System.getenv("JAVA_HOME"); String javaHome = System.getenv("JAVA_HOME");
@ -112,7 +113,8 @@ public class TestUnmanagedAMLauncher {
javaHome javaHome
+ "/bin/java -Xmx512m " + "/bin/java -Xmx512m "
+ "org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster " + "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"); LOG.info("Initializing Launcher");
UnmanagedAMLauncher launcher = new UnmanagedAMLauncher(new Configuration( UnmanagedAMLauncher launcher = new UnmanagedAMLauncher(new Configuration(