You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ep...@apache.org on 2021/08/03 21:11:05 UTC

[hadoop] branch branch-2.10 updated: MAPREDUCE-7011. TestClientDistributedCacheManager::testDetermineCacheVisibilities assumes all parent dirs set other exec

This is an automated email from the ASF dual-hosted git repository.

epayne pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-2.10 by this push:
     new f856092  MAPREDUCE-7011. TestClientDistributedCacheManager::testDetermineCacheVisibilities assumes all parent dirs set other exec
f856092 is described below

commit f856092bdbc86c515a4959b4e5c5f7bffb7ef01f
Author: Chris Douglas <cd...@apache.org>
AuthorDate: Tue Nov 21 20:42:28 2017 -0800

    MAPREDUCE-7011. TestClientDistributedCacheManager::testDetermineCacheVisibilities assumes all parent dirs set other exec
    
    (cherry picked from commit 782ba3bf9da52699b27405a3f147464975d1df99)
---
 .../TestClientDistributedCacheManager.java         | 28 ++++++++++++++--------
 1 file changed, 18 insertions(+), 10 deletions(-)

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 5212b9f..55a72bf 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
@@ -36,13 +36,16 @@ import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.SequenceFile.CompressionType;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.MRJobConfig;
+
 import org.junit.After;
-import org.junit.Assert;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
 public class TestClientDistributedCacheManager {
   private static final Log LOG = LogFactory.getLog(
       TestClientDistributedCacheManager.class);
@@ -97,15 +100,15 @@ public class TestClientDistributedCacheManager {
     FileStatus firstStatus = statCache.get(firstCacheFile.toUri());
     FileStatus secondStatus = statCache.get(secondCacheFile.toUri());
     
-    Assert.assertNotNull(firstCacheFile + " was not found in the stats cache",
+    assertNotNull(firstCacheFile + " was not found in the stats cache",
         firstStatus);
-    Assert.assertNotNull(secondCacheFile + " was not found in the stats cache",
+    assertNotNull(secondCacheFile + " was not found in the stats cache",
         secondStatus);
-    Assert.assertEquals("Missing/extra entries found in the stas cache",
+    assertEquals("Missing/extra entries found in the stats cache",
         2, statCache.size());
     String expected = firstStatus.getModificationTime() + ","
         + secondStatus.getModificationTime();
-    Assert.assertEquals(expected, jobConf.get(MRJobConfig.CACHE_FILE_TIMESTAMPS));
+    assertEquals(expected, jobConf.get(MRJobConfig.CACHE_FILE_TIMESTAMPS));
 
     job = Job.getInstance(conf);
     job.addCacheFile(new Path(TEST_VISIBILITY_CHILD_DIR, "*").toUri());
@@ -115,12 +118,12 @@ public class TestClientDistributedCacheManager {
 
     FileStatus thirdStatus = statCache.get(TEST_VISIBILITY_CHILD_DIR.toUri());
 
-    Assert.assertEquals("Missing/extra entries found in the stas cache",
+    assertEquals("Missing/extra entries found in the stats cache",
         1, statCache.size());
-    Assert.assertNotNull(TEST_VISIBILITY_CHILD_DIR
+    assertNotNull(TEST_VISIBILITY_CHILD_DIR
         + " was not found in the stats cache", thirdStatus);
     expected = Long.toString(thirdStatus.getModificationTime());
-    Assert.assertEquals("Incorrect timestamp for " + TEST_VISIBILITY_CHILD_DIR,
+    assertEquals("Incorrect timestamp for " + TEST_VISIBILITY_CHILD_DIR,
         expected, jobConf.get(MRJobConfig.CACHE_FILE_TIMESTAMPS));
   }
   
@@ -141,6 +144,11 @@ public class TestClientDistributedCacheManager {
     job.addCacheFile(relativePath.toUri());
     jobConf = job.getConfiguration();
 
+    // skip test if scratch dir is not PUBLIC
+    assumeTrue(TEST_VISIBILITY_PARENT_DIR + " is not public",
+        ClientDistributedCacheManager.isPublic(
+            jobConf, TEST_VISIBILITY_PARENT_DIR.toUri(), statCache));
+
     ClientDistributedCacheManager.determineCacheVisibilities(jobConf,
         statCache);
     // We use get() instead of getBoolean() so we can tell the difference

---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org