mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-21 23:29:47 +00:00
s3tests: extende multipart upload test
Test for issue #8452 Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
parent
474bfd2077
commit
05f45c0fe9
1 changed files with 8 additions and 3 deletions
|
@ -4088,13 +4088,13 @@ def generate_random(mb_size):
|
||||||
if (x == mb_size):
|
if (x == mb_size):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _multipart_upload(bucket, s3_key_name, mb_size, do_list=None):
|
def _multipart_upload(bucket, s3_key_name, mb_size, do_list=None, headers=None, metadata=None):
|
||||||
"""
|
"""
|
||||||
generate a multi-part upload for a random file of specifed size,
|
generate a multi-part upload for a random file of specifed size,
|
||||||
if requested, generate a list of the parts
|
if requested, generate a list of the parts
|
||||||
return the upload descriptor
|
return the upload descriptor
|
||||||
"""
|
"""
|
||||||
upload = bucket.initiate_multipart_upload(s3_key_name)
|
upload = bucket.initiate_multipart_upload(s3_key_name, headers=headers, metadata=metadata)
|
||||||
for i, part in enumerate(generate_random(mb_size)):
|
for i, part in enumerate(generate_random(mb_size)):
|
||||||
transfer_part(bucket, upload.id, upload.key_name, i, part)
|
transfer_part(bucket, upload.id, upload.key_name, i, part)
|
||||||
|
|
||||||
|
@ -4111,7 +4111,8 @@ def _multipart_upload(bucket, s3_key_name, mb_size, do_list=None):
|
||||||
def test_multipart_upload():
|
def test_multipart_upload():
|
||||||
bucket = get_new_bucket()
|
bucket = get_new_bucket()
|
||||||
key="mymultipart"
|
key="mymultipart"
|
||||||
upload = _multipart_upload(bucket, key, 30)
|
content_type='text/bla'
|
||||||
|
upload = _multipart_upload(bucket, key, 30, headers={'Content-Type': content_type}, metadata={'foo': 'bar'})
|
||||||
upload.complete_upload()
|
upload.complete_upload()
|
||||||
|
|
||||||
(obj_count, bytes_used) = _head_bucket(bucket)
|
(obj_count, bytes_used) = _head_bucket(bucket)
|
||||||
|
@ -4119,6 +4120,10 @@ def test_multipart_upload():
|
||||||
eq(obj_count, 1)
|
eq(obj_count, 1)
|
||||||
eq(bytes_used, 30 * 1024 * 1024)
|
eq(bytes_used, 30 * 1024 * 1024)
|
||||||
|
|
||||||
|
k=bucket.get_key(key)
|
||||||
|
eq(k.metadata['foo'], 'bar')
|
||||||
|
eq(k.content_type, content_type)
|
||||||
|
|
||||||
@attr(resource='object')
|
@attr(resource='object')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='check contents of multi-part upload')
|
@attr(operation='check contents of multi-part upload')
|
||||||
|
|
Loading…
Reference in a new issue