Gargi-jais11 commented on code in PR #9371:
URL: https://github.com/apache/ozone/pull/9371#discussion_r2564241543
##########
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:
We can also have a test scenario where both **headers** and **body** are
present, and check headers take precedence and the body is ignored.
Verify that the permissions set on the bucket is as per header and not
according to the body.
`testPutAclWithBothHeadersAndBody()`
- Mock header with one permission
- Provide body with different permission (should be ignored)
- Verify that READ permission was set (from header), not FULL_CONTROL (from
body)
--
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]