HADOOP-15731. TestDistributedShell fails on Windows. Contributed by Botong Huang.
This commit is contained in:
parent
a9392bdb17
commit
37032a3aca
@ -715,7 +715,9 @@ public boolean run() throws IOException, YarnException {
|
||||
|
||||
// Set java executable command
|
||||
LOG.info("Setting up app master command");
|
||||
vargs.add(Environment.JAVA_HOME.$$() + "/bin/java");
|
||||
// Need extra quote here because JAVA_HOME might contain space on Windows,
|
||||
// e.g. C:/Program Files/Java...
|
||||
vargs.add("\"" + Environment.JAVA_HOME.$$() + "/bin/java\"");
|
||||
// Set Xmx based on am memory size
|
||||
vargs.add("-Xmx" + amMemory + "m");
|
||||
// Set class name
|
||||
|
@ -758,6 +758,12 @@ private boolean checkIPs(String hostname, String localIP, String appIP)
|
||||
|
||||
}
|
||||
|
||||
private String getSleepCommand(int sec) {
|
||||
// Windows doesn't have a sleep command, ping -n does the trick
|
||||
return Shell.WINDOWS ? "ping -n " + (sec + 1) + " 127.0.0.1 >nul"
|
||||
: "sleep " + sec;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDSRestartWithPreviousRunningContainers() throws Exception {
|
||||
String[] args = {
|
||||
@ -766,7 +772,7 @@ public void testDSRestartWithPreviousRunningContainers() throws Exception {
|
||||
"--num_containers",
|
||||
"1",
|
||||
"--shell_command",
|
||||
"sleep 8",
|
||||
getSleepCommand(8),
|
||||
"--master_memory",
|
||||
"512",
|
||||
"--container_memory",
|
||||
@ -801,7 +807,7 @@ public void testDSAttemptFailuresValidityIntervalSucess() throws Exception {
|
||||
"--num_containers",
|
||||
"1",
|
||||
"--shell_command",
|
||||
"sleep 8",
|
||||
getSleepCommand(8),
|
||||
"--master_memory",
|
||||
"512",
|
||||
"--container_memory",
|
||||
@ -839,7 +845,7 @@ public void testDSAttemptFailuresValidityIntervalFailed() throws Exception {
|
||||
"--num_containers",
|
||||
"1",
|
||||
"--shell_command",
|
||||
"sleep 8",
|
||||
getSleepCommand(8),
|
||||
"--master_memory",
|
||||
"512",
|
||||
"--container_memory",
|
||||
|
Loading…
x
Reference in New Issue
Block a user