HADOOP-15793. ABFS: Skip unsupported test cases when non namespace enabled in ITestAzureBlobFileSystemAuthorization
Contributed by Yuan Gao.
This commit is contained in:
parent
5689355783
commit
43bc984891
@ -35,6 +35,7 @@
|
||||
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 void testGetFileStatusUnauthorized() throws Exception {
|
||||
@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 void testSetOwnerAuthorized() throws Exception {
|
||||
@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 void testSetOwnerUnauthorized() throws Exception {
|
||||
@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 void testSetPermissionAuthorized() throws Exception {
|
||||
@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 void testSetPermissionUnauthorized() throws Exception {
|
||||
@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<AclEntry> aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL));
|
||||
fs.modifyAclEntries(TEST_WRITE_ONLY_FILE_PATH_0, aclSpec);
|
||||
@ -244,6 +250,7 @@ public void testModifyAclEntriesAuthorized() throws Exception {
|
||||
@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<AclEntry> aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL));
|
||||
intercept(AbfsAuthorizationException.class,
|
||||
@ -255,15 +262,16 @@ public void testModifyAclEntriesUnauthorized() throws Exception {
|
||||
@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<AclEntry> 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<AclEntry> aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL));
|
||||
intercept(AbfsAuthorizationException.class,
|
||||
@ -275,6 +283,7 @@ public void testRemoveAclEntriesUnauthorized() throws Exception {
|
||||
@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 void testRemoveDefaultAclAuthorized() throws Exception {
|
||||
@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 void testRemoveDefaultAclUnauthorized() throws Exception {
|
||||
@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 void testRemoveAclAuthorized() throws Exception {
|
||||
@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 void testRemoveAclUnauthorized() throws Exception {
|
||||
@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<AclEntry> aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL));
|
||||
fs.setAcl(TEST_WRITE_ONLY_FILE_PATH_0, aclSpec);
|
||||
@ -317,6 +330,7 @@ public void testSetAclAuthorized() throws Exception {
|
||||
@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<AclEntry> aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL));
|
||||
intercept(AbfsAuthorizationException.class,
|
||||
@ -328,6 +342,7 @@ public void testSetAclUnauthorized() throws Exception {
|
||||
@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<AclEntry> aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL));
|
||||
fs.getAclStatus(TEST_WRITE_THEN_READ_ONLY_PATH);
|
||||
@ -336,6 +351,7 @@ public void testGetAclStatusAuthorized() throws Exception {
|
||||
@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<AclEntry> aclSpec = Arrays.asList(aclEntry(ACCESS, GROUP, "bar", FsAction.ALL));
|
||||
intercept(AbfsAuthorizationException.class,
|
||||
|
Loading…
Reference in New Issue
Block a user