瀏覽代碼

HDFS-11132. Allow AccessControlException in contract tests when getFileStatus on subdirectory of existing files. Contributed by Vishwajeet Dusane

(cherry picked from commit 19f373a46b2abb7a575f7884a9c7443b8ed67cd3)

Conflicts:
	hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java
John Zhuge 8 年之前
父節點
當前提交
2c5de0c60e

+ 17 - 4
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java

@@ -29,6 +29,7 @@ import org.apache.hadoop.HadoopIllegalArgumentException;
 import org.apache.hadoop.fs.Options.CreateOpts;
 import org.apache.hadoop.fs.Options.Rename;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.security.AccessControlException;
 import org.apache.hadoop.test.GenericTestUtils;
 import org.junit.After;
 import org.junit.Assert;
@@ -251,8 +252,14 @@ public abstract class FileContextMainOperationsBaseTest  {
     } catch (IOException e) {
       // expected
     }
-    Assert.assertFalse(exists(fc, testSubDir));
-    
+
+    try {
+      Assert.assertFalse(exists(fc, testSubDir));
+    } catch (AccessControlException e) {
+      // Expected : HDFS-11132 Checks on paths under file may be rejected by
+      // file missing execute permission.
+    }
+
     Path testDeepSubDir = getTestRootPath(fc, "test/hadoop/file/deep/sub/dir");
     try {
       fc.mkdir(testDeepSubDir, FsPermission.getDefault(), true);
@@ -260,8 +267,14 @@ public abstract class FileContextMainOperationsBaseTest  {
     } catch (IOException e) {
       // expected
     }
-    Assert.assertFalse(exists(fc, testDeepSubDir));
-    
+
+    try {
+      Assert.assertFalse(exists(fc, testDeepSubDir));
+    } catch (AccessControlException e) {
+      // Expected : HDFS-11132 Checks on paths under file may be rejected by
+      // file missing execute permission.
+    }
+
   }
   
   @Test

+ 17 - 4
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java

@@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.security.AccessControlException;
 
 /**
  * <p>
@@ -187,8 +188,14 @@ public abstract class FileSystemContractBaseTest extends TestCase {
     } catch (IOException e) {
       // expected
     }
-    assertFalse(fs.exists(testSubDir));
-    
+
+    try {
+      assertFalse(fs.exists(testSubDir));
+    } catch (AccessControlException e) {
+      // Expected : HDFS-11132 Checks on paths under file may be rejected by
+      // file missing execute permission.
+    }
+
     Path testDeepSubDir = path(
         "testMkdirsFailsForSubdirectoryOfExistingFile/file/deep/sub/dir");
     try {
@@ -197,8 +204,14 @@ public abstract class FileSystemContractBaseTest extends TestCase {
     } catch (IOException e) {
       // expected
     }
-    assertFalse(fs.exists(testDeepSubDir));
-    
+
+    try {
+      assertFalse(fs.exists(testDeepSubDir));
+    } catch (AccessControlException e) {
+      // Expected : HDFS-11132 Checks on paths under file may be rejected by
+      // file missing execute permission.
+    }
+
   }
 
   public void testMkdirsWithUmask() throws Exception {