From 24f813aa202610a342843e0a72c4b0cc792da771 Mon Sep 17 00:00:00 2001 From: Zhijie Shen Date: Tue, 22 Jul 2014 05:04:14 +0000 Subject: [PATCH] =?UTF-8?q?YARN-2270.=20Made=20TestFSDownload#testDownload?= =?UTF-8?q?PublicWithStatCache=20be=20skipped=20when=20there=E2=80=99s=20n?= =?UTF-8?q?o=20ancestor=20permissions.=20Contributed=20by=20Akira=20Ajisak?= =?UTF-8?q?a.=20svn=20merge=20--ignore-ancestry=20-c=201612460=20../../tru?= =?UTF-8?q?nk/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.5@1612462 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/yarn/util/FSDownload.java | 5 +++-- .../java/org/apache/hadoop/yarn/util/TestFSDownload.java | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 6dc0537faf4..edf64208bd5 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -328,6 +328,9 @@ Release 2.5.0 - UNRELEASED YARN-2158. Improved assertion messages of TestRMWebServicesAppsModification. (Varun Vasudev via zjshen) + YARN-2270. Made TestFSDownload#testDownloadPublicWithStatCache be skipped + when there’s no ancestor permissions. (Akira Ajisaka via zjshen) + Release 2.4.1 - 2014-06-23 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java index 67c3bc79480..8cc5ed36069 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java @@ -177,9 +177,10 @@ public class FSDownload implements Callable { /** * Returns true if all ancestors of the specified path have the 'execute' * permission set for all users (i.e. that other users can traverse - * the directory heirarchy to the given path) + * the directory hierarchy to the given path) */ - private static boolean ancestorsHaveExecutePermissions(FileSystem fs, + @VisibleForTesting + static boolean ancestorsHaveExecutePermissions(FileSystem fs, Path path, LoadingCache> statCache) throws IOException { Path current = path; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java index 4d0c8da21c0..02ba5fa3b40 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java @@ -23,6 +23,7 @@ import static org.apache.hadoop.fs.CreateFlag.OVERWRITE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; import java.io.File; import java.io.FileOutputStream; @@ -66,6 +67,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalDirAllocator; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; +import org.apache.hadoop.util.Shell; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.hadoop.yarn.api.records.LocalResourceType; @@ -308,6 +310,11 @@ public class TestFSDownload { FileContext files = FileContext.getLocalFSFileContext(conf); Path basedir = files.makeQualified(new Path("target", TestFSDownload.class.getSimpleName())); + + // if test directory doesn't have ancestor permission, skip this test + FileSystem f = basedir.getFileSystem(conf); + assumeTrue(FSDownload.ancestorsHaveExecutePermissions(f, basedir, null)); + files.mkdir(basedir, null, true); conf.setStrings(TestFSDownload.class.getName(), basedir.toString());