adoroszlai commented on code in PR #10309:
URL: https://github.com/apache/ozone/pull/10309#discussion_r3309029807
##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectMultiDelete.java:
##########
@@ -101,6 +104,45 @@ public void deleteQuiet() throws IOException,
OS3Exception, JAXBException {
assertEquals(0, response.getErrors().size());
}
+ @Test
+ public void multiDeleteRejectsMoreThanMaxKeysPerRequest() throws Exception {
+ OzoneClient client = new OzoneClientStub();
+ BucketEndpoint rest = EndpointBuilder.newBucketEndpointBuilder()
+ .setClient(client)
+ .build();
+
+ MultiDeleteRequest mdr = new MultiDeleteRequest();
+ for (int i = 0; i < S3Consts.S3_DELETE_OBJECTS_MAX_KEYS + 1; i++) {
+ mdr.getObjects().add(new DeleteObject("key-" + i));
+ }
+
+ OS3Exception ex = assertThrows(OS3Exception.class,
+ () -> rest.multiDelete("b1", "", mdr));
+ assertEquals("MalformedXML", ex.getCode());
+ assertEquals(HTTP_BAD_REQUEST, ex.getHttpCode());
Review Comment:
nit: can simplify using `EndpointTestUtils.assertErrorResponse`
```java
assertErrorResponse(S3ErrorTable.INVALID_ARGUMENT, () ->
rest.multiDelete("b1", "", mdr));
```
(changed error code suggested by @peterxcli)
--
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]