diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java index 12aed2959d..fa2d21fb42 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java @@ -49,9 +49,11 @@ */ public class TestTrash { - private final static Path TEST_DIR = new Path(GenericTestUtils.getTempPath( + private final static File BASE_PATH = new File(GenericTestUtils.getTempPath( "testTrash")); + private final static Path TEST_DIR = new Path(BASE_PATH.getAbsolutePath()); + @Before public void setUp() throws IOException { // ensure each test initiates a FileSystem instance, @@ -682,7 +684,7 @@ public void tearDown() throws IOException { static class TestLFS extends LocalFileSystem { Path home; TestLFS() { - this(new Path(TEST_DIR, "user/test")); + this(TEST_DIR); } TestLFS(final Path home) { super(new RawLocalFileSystem() { @@ -809,8 +811,8 @@ public static void verifyMoveEmptyDirToTrash(FileSystem fs, */ public static void verifyTrashPermission(FileSystem fs, Configuration conf) throws IOException { - Path caseRoot = new Path( - GenericTestUtils.getTempPath("testTrashPermission")); + Path caseRoot = new Path(BASE_PATH.getPath(), + "testTrashPermission"); try (FileSystem fileSystem = fs){ Trash trash = new Trash(fileSystem, conf); FileSystemTestWrapper wrapper =