forked from TrueCloudLab/s3-tests
fix test_object_copy_versioned_bucket
Do not use _create_key_with_random_content as it creates a new bucket. Check objects content and size Signed-off-by: Orit Wasserman <owasserm@redhat.com>
This commit is contained in:
parent
c961cdd10e
commit
7a437905f2
1 changed files with 23 additions and 17 deletions
|
@ -4919,42 +4919,48 @@ def test_object_copy_key_not_found():
|
||||||
def test_object_copy_versioned_bucket():
|
def test_object_copy_versioned_bucket():
|
||||||
bucket = get_new_bucket()
|
bucket = get_new_bucket()
|
||||||
check_configure_versioning_retry(bucket, True, "Enabled")
|
check_configure_versioning_retry(bucket, True, "Enabled")
|
||||||
|
|
||||||
key = bucket.new_key('foo123bar')
|
key = bucket.new_key('foo123bar')
|
||||||
_create_key_with_random_content(key.name, 1*1024*1024)
|
size = 1*1024*1024
|
||||||
|
data = str(bytearray(size))
|
||||||
|
key.set_contents_from_string(data)
|
||||||
|
|
||||||
# copy object in the same bucket
|
# copy object in the same bucket
|
||||||
key2 = bucket.copy_key('bar321foo', bucket.name, key.name, src_version_id = key.version_id)
|
key2 = bucket.copy_key('bar321foo', bucket.name, key.name, src_version_id = key.version_id)
|
||||||
res = _make_request('GET', bucket, key2)
|
key2 = bucket.get_key(key2.name)
|
||||||
eq(res.status, 200)
|
eq(key2.size, size)
|
||||||
eq(res.reason, 'OK')
|
got = key2.get_contents_as_string()
|
||||||
|
eq(got, data)
|
||||||
|
|
||||||
# second copy
|
# second copy
|
||||||
key3 = bucket.copy_key('bar321foo2', bucket.name, key2.name, src_version_id = key2.version_id)
|
key3 = bucket.copy_key('bar321foo2', bucket.name, key2.name, src_version_id = key2.version_id)
|
||||||
res = _make_request('GET', bucket, key3)
|
key3 = bucket.get_key(key3.name)
|
||||||
eq(res.status, 200)
|
eq(key3.size, size)
|
||||||
eq(res.reason, 'OK')
|
got = key3.get_contents_as_string()
|
||||||
|
eq(got, data)
|
||||||
|
|
||||||
# copy to another versioned bucket
|
# copy to another versioned bucket
|
||||||
bucket2 = get_new_bucket()
|
bucket2 = get_new_bucket()
|
||||||
check_configure_versioning_retry(bucket2, True, "Enabled")
|
check_configure_versioning_retry(bucket2, True, "Enabled")
|
||||||
key4 = bucket2.copy_key('bar321foo3', bucket.name, key.name, src_version_id = key.version_id)
|
key4 = bucket2.copy_key('bar321foo3', bucket.name, key.name, src_version_id = key.version_id)
|
||||||
res = _make_request('GET', bucket, key4)
|
key4 = bucket2.get_key(key4.name)
|
||||||
eq(res.status, 200)
|
eq(key4.size, size)
|
||||||
eq(res.reason, 'OK')
|
got = key4.get_contents_as_string()
|
||||||
|
eq(got, data)
|
||||||
|
|
||||||
# copy to another non versioned bucket
|
# copy to another non versioned bucket
|
||||||
bucket3 = get_new_bucket()
|
bucket3 = get_new_bucket()
|
||||||
key5 = bucket3.copy_key('bar321foo4', bucket.name, key.name , src_version_id = key.version_id)
|
key5 = bucket3.copy_key('bar321foo4', bucket.name, key.name , src_version_id = key.version_id)
|
||||||
res = _make_request('GET', bucket, key5)
|
key5 = bucket3.get_key(key5.name)
|
||||||
eq(res.status, 200)
|
eq(key5.size, size)
|
||||||
eq(res.reason, 'OK')
|
got = key5.get_contents_as_string()
|
||||||
|
eq(got, data)
|
||||||
|
|
||||||
# copy from a non versioned bucket
|
# copy from a non versioned bucket
|
||||||
key6 = bucket.copy_key('foo123bar2', bucket3.name, key5.name)
|
key6 = bucket.copy_key('foo123bar2', bucket3.name, key5.name)
|
||||||
res = _make_request('GET', bucket, key6)
|
key6 = bucket.get_key(key6.name)
|
||||||
eq(res.status, 200)
|
eq(key6.size, size)
|
||||||
eq(res.reason, 'OK')
|
got = key6.get_contents_as_string()
|
||||||
|
eq(got, data)
|
||||||
|
|
||||||
def transfer_part(bucket, mp_id, mp_keyname, i, part):
|
def transfer_part(bucket, mp_id, mp_keyname, i, part):
|
||||||
"""Transfer a part of a multipart upload. Designed to be run in parallel.
|
"""Transfer a part of a multipart upload. Designed to be run in parallel.
|
||||||
|
|
Loading…
Reference in a new issue