Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multipart fallback to create-multipart checksum algorithm #596

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions s3tests_boto3/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -13862,6 +13862,47 @@ def test_multipart_checksum_3parts():
response = client.head_object(Bucket=bucket, Key=key, ChecksumMode='ENABLED')
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
def test_post_object_upload_checksum():
megabytes = 1024 * 1024
Expand Down