MAPREDUCE-6533. testDetermineCacheVisibilities of 
TestClientDistributedCacheManager is broken. Contributed by Chang Li


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/df68eac8
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/df68eac8
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/df68eac8

Branch: refs/heads/HDFS-8707
Commit: df68eac825c2b64b2b2dc2193134afaf2a1d9076
Parents: d907697
Author: Jason Lowe <jl...@apache.org>
Authored: Wed Nov 11 17:26:16 2015 +0000
Committer: Jason Lowe <jl...@apache.org>
Committed: Wed Nov 11 17:26:16 2015 +0000

----------------------------------------------------------------------
 hadoop-mapreduce-project/CHANGES.txt            |  3 ++
 .../TestClientDistributedCacheManager.java      | 40 ++++++++++----------
 2 files changed, 23 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/df68eac8/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt 
b/hadoop-mapreduce-project/CHANGES.txt
index 766d300..b6dc93e 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -631,6 +631,9 @@ Release 2.8.0 - UNRELEASED
    MAPREDUCE-6515. Update Application priority in AM side from AM-RM heartbeat
    (Sunil G via jlowe)
 
+   MAPREDUCE-6533. testDetermineCacheVisibilities of
+   TestClientDistributedCacheManager is broken (Chang Li via jlowe)
+
 Release 2.7.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/df68eac8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/filecache/TestClientDistributedCacheManager.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/filecache/TestClientDistributedCacheManager.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/filecache/TestClientDistributedCacheManager.java
index 902cbfc..b5f45e6 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/filecache/TestClientDistributedCacheManager.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/filecache/TestClientDistributedCacheManager.java
@@ -44,13 +44,17 @@ public class TestClientDistributedCacheManager {
   private static final Log LOG = LogFactory.getLog(
       TestClientDistributedCacheManager.class);
   
-  private static final String TEST_ROOT_DIR = 
-      new File(System.getProperty("test.build.data", "/tmp")).toURI()
-      .toString().replace(' ', '+');
-  
-  private static final String TEST_VISIBILITY_DIR =
-      new File(TEST_ROOT_DIR, "TestCacheVisibility").toURI()
-      .toString().replace(' ', '+');
+  private static final Path TEST_ROOT_DIR = new Path(
+      System.getProperty("test.build.data",
+          System.getProperty("java.io.tmpdir")),
+      TestClientDistributedCacheManager.class.getSimpleName());
+
+  private static final Path TEST_VISIBILITY_PARENT_DIR =
+      new Path(TEST_ROOT_DIR, "TestCacheVisibility_Parent");
+
+  private static final Path TEST_VISIBILITY_CHILD_DIR =
+      new Path(TEST_VISIBILITY_PARENT_DIR, "TestCacheVisibility_Child");
+
   private FileSystem fs;
   private Path firstCacheFile;
   private Path secondCacheFile;
@@ -63,7 +67,7 @@ public class TestClientDistributedCacheManager {
     fs = FileSystem.get(conf);
     firstCacheFile = new Path(TEST_ROOT_DIR, "firstcachefile");
     secondCacheFile = new Path(TEST_ROOT_DIR, "secondcachefile");
-    thirdCacheFile = new Path(TEST_VISIBILITY_DIR,"thirdCachefile");
+    thirdCacheFile = new Path(TEST_VISIBILITY_CHILD_DIR,"thirdCachefile");
     createTempFile(firstCacheFile, conf);
     createTempFile(secondCacheFile, conf);
     createTempFile(thirdCacheFile, conf);
@@ -71,14 +75,9 @@ public class TestClientDistributedCacheManager {
   
   @After
   public void tearDown() throws IOException {
-    if (!fs.delete(firstCacheFile, false)) {
-      LOG.warn("Failed to delete firstcachefile");
-    }
-    if (!fs.delete(secondCacheFile, false)) {
-      LOG.warn("Failed to delete secondcachefile");
-    }
-    if (!fs.delete(thirdCacheFile, false)) {
-      LOG.warn("Failed to delete thirdCachefile");
+    if (fs.delete(TEST_ROOT_DIR, true)) {
+      LOG.warn("Failed to delete test root dir and its content under "
+          + TEST_ROOT_DIR);
     }
   }
   
@@ -105,10 +104,11 @@ public class TestClientDistributedCacheManager {
   
   @Test
   public void testDetermineCacheVisibilities() throws IOException {
-    Path workingdir = new Path(TEST_VISIBILITY_DIR);
-    fs.setWorkingDirectory(workingdir);
-    fs.setPermission(workingdir, new FsPermission((short)00777));
-    fs.setPermission(new Path(TEST_ROOT_DIR), new FsPermission((short)00700));
+    fs.setWorkingDirectory(TEST_VISIBILITY_CHILD_DIR);
+    fs.setPermission(TEST_VISIBILITY_CHILD_DIR,
+        new FsPermission((short)00777));
+    fs.setPermission(TEST_VISIBILITY_PARENT_DIR,
+        new FsPermission((short)00700));
     Job job = Job.getInstance(conf);
     Path relativePath = new Path("thirdCachefile");
     job.addCacheFile(relativePath.toUri());

Reply via email to