Skip to content

test: fix GetObjectAttributes to check multipart upload#1691

Merged
harshavardhana merged 3 commits intominio:masterfrom
jiuker:fix-getObjectAttributes-would't-return-parts-without-checksum
Mar 13, 2026
Merged

test: fix GetObjectAttributes to check multipart upload#1691
harshavardhana merged 3 commits intominio:masterfrom
jiuker:fix-getObjectAttributes-would't-return-parts-without-checksum

Conversation

@jiuker
Copy link
Contributor

@jiuker jiuker commented Mar 12, 2026

test: GetObjectAttributes wouldn't return parts when its putObject
CICD failed in https://github.com/miniohq/eos/pull/3330
That fix will return follow xml which is the same as AWS S3:
No parts anymore

<?xml version="1.0" encoding="UTF-8"?>
<GetObjectAttributesResponse
    xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <ETag>0df68495b5ef53a8ce2a9d4076cc6252</ETag>
    <Checksum>
        <ChecksumCRC64NVME>Mt/sLbVfRxo=</ChecksumCRC64NVME>
        <ChecksumType>FULL_OBJECT</ChecksumType>
    </Checksum>
    <StorageClass>STANDARD</StorageClass>
    <ObjectSize>6291456</ObjectSize>
</GetObjectAttributesResponse>

Copy link
Member

@balamurugana balamurugana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jiuker
Copy link
Contributor Author

jiuker commented Mar 12, 2026

According to https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAttributes.html#AmazonS3-GetObjectAttributes-response-ObjectParts, ObjectParts is returned. Is it MinIO specific change?

For the object which is putted by PutObject, just return follow XML, no parts anymore:

<?xml version="1.0" encoding="UTF-8"?>
<GetObjectAttributesResponse
    xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <ETag>0df68495b5ef53a8ce2a9d4076cc6252</ETag>
    <Checksum>
        <ChecksumCRC64NVME>Mt/sLbVfRxo=</ChecksumCRC64NVME>
        <ChecksumType>FULL_OBJECT</ChecksumType>
    </Checksum>
    <StorageClass>STANDARD</StorageClass>
    <ObjectSize>6291456</ObjectSize>
</GetObjectAttributesResponse>

If object that is putted by multiObject, would return the parts when do GetObjectAttr with Checksum.
@balamurugana
@harshavardhana Please comment more informations here.

@jiuker jiuker requested a review from balamurugana March 12, 2026 09:29
@harshavardhana
Copy link
Member

According to https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAttributes.html#AmazonS3-GetObjectAttributes-response-ObjectParts, ObjectParts is returned. Is it MinIO specific change?

@balamurugana AWS S3 doesn't behave as documented.

@harshavardhana
Copy link
Member

ObjectParts is just optional not mandatory

@jiuker jiuker force-pushed the fix-getObjectAttributes-would't-return-parts-without-checksum branch from 8af1fac to 33efc8c Compare March 12, 2026 15:15
Copy link
Member

@balamurugana balamurugana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is

diff --git a/functional/TestMinioClient.java b/functional/TestMinioClient.java
index 7196f305..70af81cd 100644
--- a/functional/TestMinioClient.java
+++ b/functional/TestMinioClient.java
@@ -3191,7 +3191,7 @@ public class TestMinioClient extends TestArgs {
       try {
         client.putObject(
             PutObjectArgs.builder().bucket(bucketName).object(objectName).stream(
-                    new ContentInputStream(1 * KB), 1L * KB, null)
+                    new ContentInputStream(6 * MB), 6L * MB, null)
                 .build());
         GetObjectAttributesResponse response =
             client.getObjectAttributes(
@@ -3204,18 +3204,41 @@ public class TestMinioClient extends TestArgs {
                         })
                     .build());
         Assertions.assertTrue(
-            response.result().objectSize() == (1 * KB),
-            "objectSize: expected: " + (1 * KB) + ", got: " + response.result().objectSize());
+            response.result().objectSize() == (6 * MB),
+            "objectSize: expected: " + (6 * MB) + ", got: " + response.result().objectSize());
         Assertions.assertTrue(
-            response.result().objectParts().parts().get(0).partNumber() == 1,
-            "partNumber: expected: 1, got: "
-                + response.result().objectParts().parts().get(0).partNumber());
+            response.result().objectParts().partsCount() == 2,
+            "partsCount: expected: "
+                + 2
+                + ", got: "
+                + response.result().objectParts().partsCount());
         Assertions.assertTrue(
-            response.result().objectParts().parts().get(0).partSize() == (1 * KB),
-            "partSize: expected: "
-                + (1 * KB)
+            response.result().objectParts().parts().size() == 2,
+            "partsSize: expected: "
+                + 2
                 + ", got: "
-                + response.result().objectParts().parts().get(0).partSize());
+                + response.result().objectParts().parts().size());
+
+        long partNumber = (long) response.result().objectParts().parts().get(0).partNumber();
+        long partSize = response.result().objectParts().parts().get(0).partSize();
+        long[][] parts =
+            (partNumber == 1)
+                ? new long[][] {{1, 6 * MB}, {2, 1 * MB}}
+                : new long[][] {{2, 1 * MB}, {1, 6 * MB}};
+        Assertions.assertTrue(
+            partNumber == parts[0][0],
+            "partEntry 0: partNumber: expected: " + parts[0][0] + ", got: " + partNumber);
+        Assertions.assertTrue(
+            partSize == parts[0][1],
+            "partEntry 0: partSize: expected: " + parts[0][1] + ", got: " + partSize);
+        partNumber = (long) response.result().objectParts().parts().get(1).partNumber();
+        partSize = response.result().objectParts().parts().get(1).partSize();
+        Assertions.assertTrue(
+            partNumber == parts[1][0],
+            "partEntry 1: partNumber: expected: " + parts[1][0] + ", got: " + partNumber);
+        Assertions.assertTrue(
+            partSize == parts[1][1],
+            "partEntry 1: partSize: expected: " + parts[1][1] + ", got: " + partSize);
         mintSuccessLog(methodName, null, startTime);
       } finally {
         client.removeObject(

@jiuker jiuker requested a review from balamurugana March 13, 2026 02:45
@balamurugana balamurugana changed the title test: GetObjectAttributes wouldn't return parts when its putObject test: fix GetObjectAttributes to check multipart upload Mar 13, 2026
@harshavardhana harshavardhana merged commit 45c1ca8 into minio:master Mar 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants