HADOOP-15498. TestHadoopArchiveLogs (#testGenerateScript, #testPrepareWorkingDir) fails on Windows. Contributed by Anbang Hu.
This commit is contained in:
parent
9dbf4f0166
commit
8fdc993a99
@ -25,6 +25,7 @@
|
|||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.fs.permission.FsAction;
|
import org.apache.hadoop.fs.permission.FsAction;
|
||||||
import org.apache.hadoop.fs.permission.FsPermission;
|
import org.apache.hadoop.fs.permission.FsPermission;
|
||||||
|
import org.apache.hadoop.util.Shell;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
|
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
|
||||||
@ -278,7 +279,7 @@ private void _testGenerateScript(boolean proxy) throws Exception {
|
|||||||
hal.generateScript(localScript);
|
hal.generateScript(localScript);
|
||||||
Assert.assertTrue(localScript.exists());
|
Assert.assertTrue(localScript.exists());
|
||||||
String script = IOUtils.toString(localScript.toURI());
|
String script = IOUtils.toString(localScript.toURI());
|
||||||
String[] lines = script.split(System.lineSeparator());
|
String[] lines = script.split("\n");
|
||||||
Assert.assertEquals(22, lines.length);
|
Assert.assertEquals(22, lines.length);
|
||||||
Assert.assertEquals("#!/bin/bash", lines[0]);
|
Assert.assertEquals("#!/bin/bash", lines[0]);
|
||||||
Assert.assertEquals("set -e", lines[1]);
|
Assert.assertEquals("set -e", lines[1]);
|
||||||
@ -368,7 +369,8 @@ public void testPrepareWorkingDir() throws Exception {
|
|||||||
Assert.assertTrue(dirPrepared);
|
Assert.assertTrue(dirPrepared);
|
||||||
Assert.assertTrue(fs.exists(workingDir));
|
Assert.assertTrue(fs.exists(workingDir));
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL, true),
|
new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL,
|
||||||
|
!Shell.WINDOWS),
|
||||||
fs.getFileStatus(workingDir).getPermission());
|
fs.getFileStatus(workingDir).getPermission());
|
||||||
// Throw a file in the dir
|
// Throw a file in the dir
|
||||||
Path dummyFile = new Path(workingDir, "dummy.txt");
|
Path dummyFile = new Path(workingDir, "dummy.txt");
|
||||||
@ -381,7 +383,8 @@ public void testPrepareWorkingDir() throws Exception {
|
|||||||
Assert.assertTrue(fs.exists(workingDir));
|
Assert.assertTrue(fs.exists(workingDir));
|
||||||
Assert.assertTrue(fs.exists(dummyFile));
|
Assert.assertTrue(fs.exists(dummyFile));
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL, true),
|
new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL,
|
||||||
|
!Shell.WINDOWS),
|
||||||
fs.getFileStatus(workingDir).getPermission());
|
fs.getFileStatus(workingDir).getPermission());
|
||||||
// -force is true and the dir exists, so it will recreate it and the dummy
|
// -force is true and the dir exists, so it will recreate it and the dummy
|
||||||
// won't exist anymore
|
// won't exist anymore
|
||||||
@ -390,7 +393,8 @@ public void testPrepareWorkingDir() throws Exception {
|
|||||||
Assert.assertTrue(dirPrepared);
|
Assert.assertTrue(dirPrepared);
|
||||||
Assert.assertTrue(fs.exists(workingDir));
|
Assert.assertTrue(fs.exists(workingDir));
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL, true),
|
new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL,
|
||||||
|
!Shell.WINDOWS),
|
||||||
fs.getFileStatus(workingDir).getPermission());
|
fs.getFileStatus(workingDir).getPermission());
|
||||||
Assert.assertFalse(fs.exists(dummyFile));
|
Assert.assertFalse(fs.exists(dummyFile));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user