]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
s3tests: add regression test for bug #10311 - rgw: Object is deleted automatically... 27/head
authorRay Lv <raylv@yahoo-inc.com>
Mon, 15 Dec 2014 08:47:34 +0000 (16:47 +0800)
committerRay Lv <raylv@yahoo-inc.com>
Mon, 15 Dec 2014 08:47:34 +0000 (16:47 +0800)
Test for bug #10311

Signed-off-by: Ray Lv <raylv@yahoo-inc.com>
s3tests/functional/test_s3.py

index 3c8ff22f8f3150e7cc92bac651d7cc6343772a9b..acd914f5bed6dbfad69b7412a131c73f72f407d9 100644 (file)
@@ -2086,6 +2086,9 @@ def test_put_object_ifmatch_failed():
     eq(e.reason, 'Precondition Failed')
     eq(e.error_code, 'PreconditionFailed')
 
+    got_old_data = key.get_contents_as_string()
+    eq(got_old_data, 'bar')
+
 
 @attr(resource='object')
 @attr(method='put')
@@ -2117,6 +2120,10 @@ def test_put_object_ifmatch_nonexisted_failed():
     eq(e.reason, 'Precondition Failed')
     eq(e.error_code, 'PreconditionFailed')
 
+    e = assert_raises(boto.exception.S3ResponseError, key.get_contents_as_string)
+    eq(e.status, 404)
+    eq(e.reason, 'Not Found')
+    eq(e.error_code, 'NoSuchKey')
 
 @attr(resource='object')
 @attr(method='put')
@@ -2153,6 +2160,8 @@ def test_put_object_ifnonmatch_failed():
     eq(e.reason, 'Precondition Failed')
     eq(e.error_code, 'PreconditionFailed')
 
+    got_old_data = key.get_contents_as_string()
+    eq(got_old_data, 'bar')
 
 @attr(resource='object')
 @attr(method='put')
@@ -2185,6 +2194,9 @@ def test_put_object_ifnonmatch_overwrite_existed_failed():
     eq(e.reason, 'Precondition Failed')
     eq(e.error_code, 'PreconditionFailed')
 
+    got_old_data = key.get_contents_as_string()
+    eq(got_old_data, 'bar')
+
 
 def _setup_request(bucket_acl=None, object_acl=None):
     """