mneethiraj commented on code in PR #10108:
URL: https://github.com/apache/ozone/pull/10108#discussion_r3127378549
##########
hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/security/acl/TestAssumeRoleRequest.java:
##########
@@ -36,23 +38,32 @@ public class TestAssumeRoleRequest {
@Test
public void testConstructorAndGetters() {
final UserGroupInformation ugi =
UserGroupInformation.createRemoteUser("om");
+ final IOzoneObj bucketObj =
+ OzoneObjInfo.Builder.newBuilder()
+ .setResType(OzoneObj.ResourceType.BUCKET)
+ .setStoreType(OzoneObj.StoreType.OZONE)
+ .setVolumeName("s3v")
+ .setBucketName("myBucket")
+ .build();
+ final Set<IOzoneObj> objects = Collections.singleton(bucketObj);
+ final Set<IAccessAuthorizer.ACLType> permissions =
Collections.singleton(IAccessAuthorizer.ACLType.READ);
+ final Set<String> s3Actions = Collections.emptySet();
+
final Set<AssumeRoleRequest.OzoneGrant> grants = new HashSet<>();
- grants.add(
- new AssumeRoleRequest.OzoneGrant(
- Collections.singleton(
- OzoneObjInfo.Builder.newBuilder()
- .setResType(OzoneObj.ResourceType.BUCKET)
- .setStoreType(OzoneObj.StoreType.OZONE)
- .setVolumeName("s3v")
- .setBucketName("myBucket")
- .build()),
- Collections.singleton(IAccessAuthorizer.ACLType.READ)));
+ grants.add(new AssumeRoleRequest.OzoneGrant(objects, permissions,
s3Actions));
final AssumeRoleRequest assumeRoleRequest1 = new AssumeRoleRequest(
"host", null, ugi, "roleA", grants);
final AssumeRoleRequest assumeRoleRequest2 = new AssumeRoleRequest(
"host", null, ugi, "roleA", grants);
+ final AssumeRoleRequest.OzoneGrant grant = grants.iterator().next();
+ assertEquals(objects, grant.getObjects());
+ assertEquals(permissions, grant.getPermissions());
+ assertEquals(s3Actions, grant.getS3Actions());
+ // Ensure the s3 actions are not modifiable
+ assertThrows(UnsupportedOperationException.class, () ->
grant.getS3Actions().add("s3:GetObject"));
Review Comment:
Remove "s3:" prefix, from here and other occurrences as well?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]