Russole commented on code in PR #9371:
URL: https://github.com/apache/ozone/pull/9371#discussion_r2571655176


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestBucketPut.java:
##########
@@ -51,16 +80,36 @@ public void setup() throws Exception {
     bucketEndpoint = EndpointBuilder.newBucketEndpointBuilder()
         .setClient(clientStub)
         .build();
+
+    mockHeaders = mock(HttpHeaders.class);
+    bucketEndpoint.setHeaders(mockHeaders);
+  }
+
+  @Test
+  public void testAclWithMissingHeaders() throws Exception {
+    bucketEndpoint.getClient().getObjectStore().createS3Bucket(bucketName);
+
+    InputStream body = new 
ByteArrayInputStream(VALID_ACL_XML.getBytes(StandardCharsets.UTF_8));
+
+    Response resp = bucketEndpoint.put(bucketName, "acl", body);
+    Assertions.assertEquals(200, resp.getStatus());
   }
 
   @Test
-  public void testBucketFailWithAuthHeaderMissing() throws Exception {
-    try {
-      bucketEndpoint.put(bucketName, null, null);
-    } catch (OS3Exception ex) {
-      assertEquals(HTTP_NOT_FOUND, ex.getHttpCode());
-      assertEquals(MALFORMED_HEADER.getCode(), ex.getCode());
-    }
+  public void testAclWithMissingHeadersAndNoBody() throws Exception {

Review Comment:
   Thanks for the suggestion, I have added a new test to cover this scenario:
   In this test:
   * The header grants READ via x-amz-grant-read (id=owner-id),
   * The XML body (VALID_ACL_XML) grants FULL_CONTROL,
   * The call succeeds with HTTP 200, and We verify that an ACL entry for 
owner-id with ACCESS scope is present on  the bucket, which is derived from the 
header.
   
   Since putAcl() only takes the header-based path when any grant header is 
present (and skips the body in that case), this test documents that the header 
takes precedence over the body when both are provided.



-- 
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]

Reply via email to