multipart fallback to create-multipart checksum algorithm

there seem to be workloads which assume checksum algorithm can be
omitted from upload-part

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
This commit is contained in:
Matt Benjamin 2024-10-13 10:47:17 -04:00
parent 08df9352f9
commit 811ab17ed0

View file

@ -13862,6 +13862,47 @@ def test_multipart_checksum_3parts():
response = client.head_object(Bucket=bucket, Key=key, ChecksumMode='ENABLED') response = client.head_object(Bucket=bucket, Key=key, ChecksumMode='ENABLED')
assert composite_sha256sum == response['ChecksumSHA256'] assert composite_sha256sum == response['ChecksumSHA256']
@pytest.mark.checksum
@pytest.mark.fails_on_dbstore
def test_multipart_checksum_upload_fallback():
bucket = get_new_bucket()
client = get_client()
key = "mpu_cksum_fallback"
alg = 'SHA256'
response = client.create_multipart_upload(
Bucket=bucket, Key=key, ChecksumAlgorithm=alg)
assert alg == response['ChecksumAlgorithm']
upload_id = response['UploadId']
nparts = 3
parts = []
size = 5 * 1024 * 1024 # each part but the last must be at least 5M
for ix in range(0,nparts):
body = FakeWriteFile(size, 'A')
part_num = ix + 1
res = client.upload_part(UploadId=upload_id, Bucket=bucket,
Key=key, PartNumber=part_num, Body=body)
etag = res['ETag']
part = {'ETag': etag, 'PartNumber': part_num}
parts.append(part)
res = client.complete_multipart_upload(
Bucket=bucket, Key=key, UploadId=upload_id,
MultipartUpload={'Parts': parts})
#pdb.set_trace()
assert res['ResponseMetadata']['HTTPStatusCode'] == 200
# not yet merged
#request_attributes = ['ETag', 'Checksum', 'ObjectParts', 'StorageClass',
# 'ObjectSize']
#res = client.get_object_attributes(Bucket=bucket, Key=key, \
# ObjectAttributes=request_attributes)
#upload_checksum = res['Checksum']['ChecksumSHA256']
@pytest.mark.checksum @pytest.mark.checksum
def test_post_object_upload_checksum(): def test_post_object_upload_checksum():
megabytes = 1024 * 1024 megabytes = 1024 * 1024