diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java index 5f9151a9f8..2b3ab2a0d9 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java @@ -29,6 +29,7 @@ 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 void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception { } 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 void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception { } 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 diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java index bbd733691b..6247959182 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java @@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.permission.FsPermission; +import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.util.StringUtils; /** @@ -158,7 +159,13 @@ public void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception { } 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("/test/hadoop/file/deep/sub/dir"); try { @@ -167,7 +174,13 @@ public void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception { } 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. + } }