]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Add testing for copy object to/from a versioned bucket 125/head
authorOrit Wasserman <owasserm@redhat.com>
Wed, 14 Sep 2016 08:23:29 +0000 (10:23 +0200)
committerOrit Wasserman <owasserm@redhat.com>
Wed, 14 Sep 2016 10:31:07 +0000 (12:31 +0200)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
s3tests/functional/test_s3.py

index cc7d7e568df6c834204fbb5af6ad21f45670da33..2757c681ee8c3aa1d1fa2465bd135b73a7049fdd 100644 (file)
@@ -4912,6 +4912,50 @@ def test_object_copy_key_not_found():
     eq(e.reason, 'Not Found')
     eq(e.error_code, 'NoSuchKey')
 
+@attr(resource='object')
+@attr(method='put')
+@attr(operation='copy object to/from versioned bucket')
+@attr(assertion='works')
+def test_object_copy_versioned_bucket():
+    bucket = get_new_bucket()
+    check_configure_versioning_retry(bucket, True, "Enabled")
+
+    key = bucket.new_key('foo123bar')
+    _create_key_with_random_content(key.name, 1*1024*1024)
+
+    # copy object in the same bucket
+    key2 = bucket.copy_key('bar321foo', bucket.name, key.name, src_version_id = key.version_id)
+    res = _make_request('GET', bucket, key2)
+    eq(res.status, 200)
+    eq(res.reason, 'OK')
+
+    # second copy
+    key3 = bucket.copy_key('bar321foo2', bucket.name, key2.name, src_version_id = key2.version_id)
+    res = _make_request('GET', bucket, key3)
+    eq(res.status, 200)
+    eq(res.reason, 'OK')
+
+    # copy to another versioned bucket
+    bucket2 = get_new_bucket()
+    check_configure_versioning_retry(bucket2, True, "Enabled")
+    key4 = bucket2.copy_key('bar321foo3', bucket.name, key.name, src_version_id = key.version_id)
+    res = _make_request('GET', bucket, key4)
+    eq(res.status, 200)
+    eq(res.reason, 'OK')
+
+    # copy to another non versioned bucket
+    bucket3 = get_new_bucket()
+    key5 = bucket3.copy_key('bar321foo4', bucket.name, key.name , src_version_id = key.version_id)
+    res = _make_request('GET', bucket, key5)
+    eq(res.status, 200)
+    eq(res.reason, 'OK')
+
+    # copy from a non versioned bucket
+    key6 = bucket.copy_key('foo123bar2', bucket3.name, key5.name)
+    res = _make_request('GET', bucket, key6)
+    eq(res.status, 200)
+    eq(res.reason, 'OK')
+
 def transfer_part(bucket, mp_id, mp_keyname, i, part):
     """Transfer a part of a multipart upload. Designed to be run in parallel.
     """