From f16e379b47d64112c9b67c11e555ccc4afdee501 Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Tue, 26 Jun 2012 16:24:51 +0000 Subject: [PATCH] svn merge -c 1354093. FIXES: HADOOP-8129. ViewFileSystemTestSetup setupForViewFileSystem is erring (Ahmed Radwan and Ravi Prakash via bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1354096 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../hadoop/fs/viewfs/ViewFileSystemTestSetup.java | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 453a35df4b3..92c4ae5e4c7 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -573,6 +573,9 @@ Release 0.23.3 - UNRELEASED HADOOP-8495. Update Netty to avoid leaking file descriptors during shuffle (Jason Lowe via tgraves) + HADOOP-8129. ViewFileSystemTestSetup setupForViewFileSystem is erring + (Ahmed Radwan and Ravi Prakash via bobby) + Release 0.23.2 - UNRELEASED NEW FEATURES diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java index 11f4d7af713..525f28bea7c 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java @@ -51,7 +51,19 @@ public class ViewFileSystemTestSetup { /** * create the test root on local_fs - the mount table will point here */ - fsTarget.mkdirs(FileSystemTestHelper.getTestRootPath(fsTarget)); + Path targetOfTests = FileSystemTestHelper.getTestRootPath(fsTarget); + // In case previous test was killed before cleanup + fsTarget.delete(targetOfTests, true); + fsTarget.mkdirs(targetOfTests); + + // Setup a link from viewfs to targetfs for the first component of + // path of testdir. + String testDir = FileSystemTestHelper.getTestRootPath(fsTarget).toUri() + .getPath(); + int indexOf2ndSlash = testDir.indexOf('/', 1); + String testDirFirstComponent = testDir.substring(0, indexOf2ndSlash); + ConfigUtil.addLink(conf, testDirFirstComponent, fsTarget.makeQualified( + new Path(testDirFirstComponent)).toUri()); // viewFs://home => fsTarget://home String homeDirRoot = fsTarget.getHomeDirectory()