]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/rgw: test_bucket_delete_notempty in test_multi.py 14090/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 22 Mar 2017 18:12:27 +0000 (14:12 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 22 Mar 2017 18:37:00 +0000 (14:37 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/test/rgw/test_multi.py

index a0e7d48e7235c4f38f096efa87f604a8e8a9ca12..636c0ac46dca6117e5d1c4b196a1c64f93c497e8 100644 (file)
@@ -821,6 +821,30 @@ def test_bucket_acl():
         bucket.set_acl('public-read')
         assert(len(bucket.get_acl().acl.grants) == 2) # new grant on AllUsers
 
+def test_bucket_delete_notempty():
+    buckets, zone_bucket = create_bucket_per_zone()
+    realm.meta_checkpoint()
+
+    for zone, bucket_name in zone_bucket.items():
+        # upload an object to each bucket on its own zone
+        conn = zone.get_connection(user)
+        bucket = conn.get_bucket(bucket_name)
+        k = bucket.new_key('foo')
+        k.set_contents_from_string('bar')
+        # attempt to delete the bucket before this object can sync
+        try:
+            conn.delete_bucket(bucket_name)
+        except boto.exception.S3ResponseError, e:
+            assert(e.error_code == 'BucketNotEmpty')
+            continue
+        assert False # expected 409 BucketNotEmpty
+
+    # assert that each bucket still exists on the master
+    z1 = realm.get_zone('us-1')
+    c1 = z1.get_connection(user)
+    for _, bucket_name in zone_bucket.items():
+        assert c1.get_bucket(bucket_name)
+
 def test_multi_period_incremental_sync():
     if len(realm.clusters) < 3:
         from nose.plugins.skip import SkipTest