mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-25 03:47:22 +00:00
test_s3: test multi-part uploads using boto provided functionality.
Tests the implementation of multi-part upload and verifies written object. Signed-off-by: caleb miles <caleb.miles@inktank.com>
This commit is contained in:
parent
834800f341
commit
0eed1a3bba
1 changed files with 42 additions and 0 deletions
|
@ -2884,6 +2884,48 @@ def test_multipart_upload():
|
||||||
upload = _multipart_upload(bucket, key, 30)
|
upload = _multipart_upload(bucket, key, 30)
|
||||||
upload.complete_upload()
|
upload.complete_upload()
|
||||||
|
|
||||||
|
|
||||||
|
@attr(resource='object')
|
||||||
|
@attr(method='put')
|
||||||
|
@attr(operation='check contents of multi-part upload')
|
||||||
|
@attr(assertion='successful')
|
||||||
|
def test_multipart_upload_contents():
|
||||||
|
bucket = get_new_bucket()
|
||||||
|
key_name="mymultipart"
|
||||||
|
num_parts=5
|
||||||
|
payload='foo'*10*1024*1024
|
||||||
|
mp=bucket.initiate_multipart_upload(key_name)
|
||||||
|
for i in range(0, num_parts):
|
||||||
|
mp.upload_part_from_file(StringIO(payload), i+1)
|
||||||
|
|
||||||
|
mp.complete_upload()
|
||||||
|
key=bucket.get_key(key_name)
|
||||||
|
test_string=key.get_contents_as_string()
|
||||||
|
assert test_string == payload*num_parts
|
||||||
|
|
||||||
|
|
||||||
|
@attr(resource='object')
|
||||||
|
@attr(method='put')
|
||||||
|
@attr(operation=' multi-part upload overwrites existing key')
|
||||||
|
@attr(assertion='successful')
|
||||||
|
def test_multipart_upload_overwrite_existing_object():
|
||||||
|
bucket = get_new_bucket()
|
||||||
|
key_name="mymultipart"
|
||||||
|
payload='bar'*10*1024*1024
|
||||||
|
num_parts=5
|
||||||
|
key=bucket.new_key(key_name)
|
||||||
|
key.set_contents_from_string(payload)
|
||||||
|
|
||||||
|
mp=bucket.initiate_multipart_upload(key_name)
|
||||||
|
for i in range(0, num_parts):
|
||||||
|
mp.upload_part_from_file(StringIO(payload), i+1)
|
||||||
|
|
||||||
|
mp.complete_upload()
|
||||||
|
key=bucket.get_key(key_name)
|
||||||
|
test_string=key.get_contents_as_string()
|
||||||
|
assert test_string == payload*num_parts
|
||||||
|
|
||||||
|
|
||||||
@attr(resource='object')
|
@attr(resource='object')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='abort multi-part upload')
|
@attr(operation='abort multi-part upload')
|
||||||
|
|
Loading…
Reference in a new issue