diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAuthorization.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAuthorization.java index 37ab825dfda..17055169773 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAuthorization.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAuthorization.java @@ -35,6 +35,7 @@ import static org.apache.hadoop.fs.azurebfs.utils.AclTestHelpers.aclEntry; import static org.apache.hadoop.fs.permission.AclEntryScope.ACCESS; import static org.apache.hadoop.fs.permission.AclEntryType.GROUP; import static org.apache.hadoop.test.LambdaTestUtils.intercept; +import static org.junit.Assume.assumeTrue; /** * Test Perform Authorization Check operation @@ -202,6 +203,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testSetOwnerAuthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_ONLY_FILE_PATH_0).close(); fs.setOwner(TEST_WRITE_ONLY_FILE_PATH_0, "testUser", "testGroup"); } @@ -209,6 +211,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testSetOwnerUnauthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_THEN_READ_ONLY_PATH).close(); intercept(AbfsAuthorizationException.class, ()-> { @@ -219,6 +222,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testSetPermissionAuthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_ONLY_FILE_PATH_0).close(); fs.setPermission(TEST_WRITE_ONLY_FILE_PATH_0, new FsPermission(FsAction.ALL, FsAction.NONE, FsAction.NONE)); } @@ -226,6 +230,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testSetPermissionUnauthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_THEN_READ_ONLY_PATH).close(); intercept(AbfsAuthorizationException.class, ()-> { @@ -236,6 +241,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testModifyAclEntriesAuthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_ONLY_FILE_PATH_0).close(); List aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL)); fs.modifyAclEntries(TEST_WRITE_ONLY_FILE_PATH_0, aclSpec); @@ -244,6 +250,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testModifyAclEntriesUnauthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_THEN_READ_ONLY_PATH).close(); List aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL)); intercept(AbfsAuthorizationException.class, @@ -255,15 +262,16 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testRemoveAclEntriesAuthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_ONLY_FILE_PATH_0).close(); List aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL)); - //fs.modifyAclEntries(TEST_WRITE_ONLY_FILE_PATH_0, aclSpec); fs.removeAclEntries(TEST_WRITE_ONLY_FILE_PATH_0, aclSpec); } @Test public void testRemoveAclEntriesUnauthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_THEN_READ_ONLY_PATH).close(); List aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL)); intercept(AbfsAuthorizationException.class, @@ -275,6 +283,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testRemoveDefaultAclAuthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_ONLY_FILE_PATH_0).close(); fs.removeDefaultAcl(TEST_WRITE_ONLY_FILE_PATH_0); } @@ -282,6 +291,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testRemoveDefaultAclUnauthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_THEN_READ_ONLY_PATH).close(); intercept(AbfsAuthorizationException.class, ()-> { @@ -292,6 +302,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testRemoveAclAuthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_ONLY_FILE_PATH_0).close(); fs.removeAcl(TEST_WRITE_ONLY_FILE_PATH_0); } @@ -299,6 +310,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testRemoveAclUnauthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_THEN_READ_ONLY_PATH).close(); intercept(AbfsAuthorizationException.class, ()-> { @@ -309,6 +321,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testSetAclAuthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_ONLY_FILE_PATH_0).close(); List aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL)); fs.setAcl(TEST_WRITE_ONLY_FILE_PATH_0, aclSpec); @@ -317,6 +330,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testSetAclUnauthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_THEN_READ_ONLY_PATH).close(); List aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL)); intercept(AbfsAuthorizationException.class, @@ -328,6 +342,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testGetAclStatusAuthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_THEN_READ_ONLY_PATH).close(); List aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL)); fs.getAclStatus(TEST_WRITE_THEN_READ_ONLY_PATH); @@ -336,6 +351,7 @@ public class ITestAzureBlobFileSystemAuthorization extends AbstractAbfsIntegrati @Test public void testGetAclStatusUnauthorized() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + assumeTrue("This test case only runs when namespace is enabled", fs.getIsNamespaceEnabeld()); fs.create(TEST_WRITE_ONLY_FILE_PATH_0).close(); List aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL)); intercept(AbfsAuthorizationException.class,