]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/rgw: add test_zonegroup_remove 9015/head
authorCasey Bodley <cbodley@redhat.com>
Fri, 6 May 2016 18:26:46 +0000 (14:26 -0400)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 9 May 2016 22:59:12 +0000 (15:59 -0700)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit e2b27c7266f0ace372dbf94e062598fd7a575795)

src/test/rgw/test_multi.py

index 811ec47e7c6098abb2031ef62b9bd094215d89a4..d4efb5b49cf15ba1443a3cdc55bc09e9211bf7e1 100644 (file)
@@ -176,6 +176,8 @@ class RGWRealm:
         if is_master:
             self.master_zone = zone
 
+    def remove_zone(self, zone_name):
+        del self.zones[zone_name]
 
     def get_zone(self, zone_name):
         return self.zones[zone_name]
@@ -776,6 +778,25 @@ def test_multi_period_incremental_sync():
 
             check_bucket_eq(source_zone, target_zone, bucket)
 
+# TODO: test this in isolation, so it doesn't have side effects on other tests
+def test_zonegroup_remove():
+    z1 = realm.get_zone('us-1')
+
+    # try to 'zone delete' us-2 from cluster 1
+    # must fail with ENOENT because the zone is local to cluster 2
+    (_, retcode) = z1.cluster.rgw_admin('zone delete --rgw-zone=us-2', False)
+    assert(retcode == 2) # ENOENT
+
+    # use 'zonegroup remove', expecting success
+    z1.cluster.rgw_admin('zonegroup remove --rgw-zone=us-2', True)
+
+    # another 'zonegroup remove' should fail with ENOENT
+    (_, retcode) = z1.cluster.rgw_admin('zonegroup remove --rgw-zone=us-2', False)
+    assert(retcode == 2) # ENOENT
+
+    # validate the resulting period
+    z1.cluster.rgw_admin('period update --commit', True)
+    realm.remove_zone('us-2')
 
 def init(parse_args):
     cfg = ConfigParser.RawConfigParser({