xiaoyuyao commented on a change in pull request #1202: HDDS-1884. Support
Bucket ACL operations for OM HA.
URL: https://github.com/apache/hadoop/pull/1202#discussion_r311378194
##########
File path:
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHA.java
##########
@@ -759,6 +768,140 @@ public void testReadRequest() throws Exception {
}
}
+ @Test
+ public void testAddBucketAcl() throws Exception {
+ OzoneBucket ozoneBucket = setupBucket();
+ String remoteUserName = "remoteUser";
+ OzoneAcl defaultUserAcl = new OzoneAcl(USER, remoteUserName,
+ READ, DEFAULT);
+
+ OzoneObj ozoneObj = OzoneObjInfo.Builder.newBuilder()
+ .setResType(OzoneObj.ResourceType.BUCKET)
+ .setStoreType(OzoneObj.StoreType.OZONE)
+ .setVolumeName(ozoneBucket.getVolumeName())
+ .setBucketName(ozoneBucket.getName()).build();
+
+ boolean addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl);
+ Assert.assertTrue(addAcl);
+
+ ozoneBucket.addAcls(Collections.singletonList(defaultUserAcl));
+ List<OzoneAcl> acls = objectStore.getAcl(ozoneObj);
+
+ Assert.assertTrue(containsAcl(defaultUserAcl, acls));
+
+ // Add an already existing acl.
+ addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl);
+ Assert.assertFalse(addAcl);
+
+ // Add an acl by changing acl type with same type, name and scope.
+ defaultUserAcl = new OzoneAcl(USER, remoteUserName,
+ WRITE, DEFAULT);
+ addAcl = objectStore.addAcl(ozoneObj, defaultUserAcl);
+ Assert.assertTrue(addAcl);
+ }
+
+ @Test
+ public void testRemoveBucketAcl() throws Exception {
+ OzoneBucket ozoneBucket = setupBucket();
+ String remoteUserName = "remoteUser";
+ OzoneAcl defaultUserAcl = new OzoneAcl(USER, remoteUserName,
+ READ, DEFAULT);
+
+ OzoneObj ozoneObj = OzoneObjInfo.Builder.newBuilder()
+ .setResType(OzoneObj.ResourceType.BUCKET)
+ .setStoreType(OzoneObj.StoreType.OZONE)
+ .setVolumeName(ozoneBucket.getVolumeName())
+ .setBucketName(ozoneBucket.getName()).build();
+
+ // As by default create bucket we add some default acls in RpcClient.
+ List<OzoneAcl> acls = objectStore.getAcl(ozoneObj);
+
+ Assert.assertTrue(acls.size() > 0);
+
+ // Remove an existing acl.
+ boolean removeAcl = objectStore.removeAcl(ozoneObj, acls.get(0));
Review comment:
Similarly, OzoneBucket#removeAcls does not handle the case when input acl is
a subset of existing acls.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]