HADOOP-15497. TestTrash should use proper test path to avoid failing on Windows. Contributed by Anbang Hu.
(cherry picked from commit 3c75f8e493
)
This commit is contained in:
parent
0fc8b43dc8
commit
09fbbff695
|
@ -48,9 +48,11 @@ import org.junit.Test;
|
||||||
*/
|
*/
|
||||||
public class TestTrash extends TestCase {
|
public class TestTrash extends TestCase {
|
||||||
|
|
||||||
private final static Path TEST_DIR = new Path(GenericTestUtils.getTempPath(
|
private final static File BASE_PATH = new File(GenericTestUtils.getTempPath(
|
||||||
"testTrash"));
|
"testTrash"));
|
||||||
|
|
||||||
|
private final static Path TEST_DIR = new Path(BASE_PATH.getAbsolutePath());
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws IOException {
|
public void setUp() throws IOException {
|
||||||
// ensure each test initiates a FileSystem instance,
|
// ensure each test initiates a FileSystem instance,
|
||||||
|
@ -680,7 +682,7 @@ public class TestTrash extends TestCase {
|
||||||
static class TestLFS extends LocalFileSystem {
|
static class TestLFS extends LocalFileSystem {
|
||||||
Path home;
|
Path home;
|
||||||
TestLFS() {
|
TestLFS() {
|
||||||
this(new Path(TEST_DIR, "user/test"));
|
this(TEST_DIR);
|
||||||
}
|
}
|
||||||
TestLFS(final Path home) {
|
TestLFS(final Path home) {
|
||||||
super(new RawLocalFileSystem() {
|
super(new RawLocalFileSystem() {
|
||||||
|
@ -807,8 +809,8 @@ public class TestTrash extends TestCase {
|
||||||
*/
|
*/
|
||||||
public static void verifyTrashPermission(FileSystem fs, Configuration conf)
|
public static void verifyTrashPermission(FileSystem fs, Configuration conf)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Path caseRoot = new Path(
|
Path caseRoot = new Path(BASE_PATH.getPath(),
|
||||||
GenericTestUtils.getTempPath("testTrashPermission"));
|
"testTrashPermission");
|
||||||
try (FileSystem fileSystem = fs){
|
try (FileSystem fileSystem = fs){
|
||||||
Trash trash = new Trash(fileSystem, conf);
|
Trash trash = new Trash(fileSystem, conf);
|
||||||
FileSystemTestWrapper wrapper =
|
FileSystemTestWrapper wrapper =
|
||||||
|
|
Loading…
Reference in New Issue