peterxcli commented on code in PR #10224:
URL: https://github.com/apache/ozone/pull/10224#discussion_r3212980833


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestPartUpload.java:
##########
@@ -126,6 +127,42 @@ public void testPartUpload() throws Exception {
     }
   }
 
+  @Test
+  public void testPartUploadWithStandardIA() throws Exception {
+    when(headers.getHeaderString(STORAGE_CLASS_HEADER))
+        .thenReturn(S3StorageType.STANDARD_IA.name(), (String)null);
+    String keyName = UUID.randomUUID().toString();
+    String uploadID = initiateMultipartUpload(rest, OzoneConsts.S3_BUCKET, 
keyName);
+
+    String content = "Multipart Upload";
+    try (Response response = put(rest, OzoneConsts.S3_BUCKET, keyName, 1, 
uploadID, content)) {
+      assertNotNull(response.getHeaderString(OzoneConsts.ETAG));
+      assertEquals(200, response.getStatus());
+    }
+    assertContentLength(uploadID, keyName, content.length());
+  }
+
+  @Test
+  public void testPartUploadWithStandardIAAndContentMD5() throws Exception {
+    when(headers.getHeaderString(STORAGE_CLASS_HEADER))
+        .thenReturn(S3StorageType.STANDARD_IA.name(), (String)null);
+    String content = "Multipart Upload Part";
+    byte[] contentBytes = content.getBytes(StandardCharsets.UTF_8);
+    byte[] md5Bytes = MessageDigest.getInstance("MD5").digest(contentBytes);
+    String md5Base64 = Base64.getEncoder().encodeToString(md5Bytes);
+    when(headers.getHeaderString("Content-MD5")).thenReturn(md5Base64);
+
+    String keyName = UUID.randomUUID().toString();
+    String uploadID = initiateMultipartUpload(rest, OzoneConsts.S3_BUCKET, 
keyName);
+
+    try (Response response = put(rest, OzoneConsts.S3_BUCKET, keyName, 1,
+        uploadID, content)) {
+      assertNotNull(response.getHeaderString(OzoneConsts.ETAG));
+      assertEquals(200, response.getStatus());
+    }
+    assertContentLength(uploadID, keyName, content.length());
+  }

Review Comment:
   this test case would fail on master with:
   ```
   NullPointerException: Cannot invoke
   
"org.apache.hadoop.ozone.client.io.KeyDataStreamOutput.setPreCommits(java.util.List)"
   because the return value of
   "OzoneDataStreamOutput.getKeyDataStreamOutput()" is null
   
   at 
ObjectEndpointStreaming.createMultipartKey(ObjectEndpointStreaming.java:243)
   ```



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