]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: tests for master zone deletion
authorAbhishek Lekshmanan <abhishek@suse.com>
Tue, 20 Nov 2018 13:30:32 +0000 (14:30 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Thu, 22 Nov 2018 10:58:13 +0000 (11:58 +0100)
Adding a basic test in test_multi that creates a new zonegroup and zone and
removes them, period update after zone deletion will fail now lessening the
chance for the period referring to a non existant master_zone. Subsequent
zonegroup deletion will allow things to pass.

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit e3d60c053316c1bc108ca3b3c38f8354db3690be)

src/test/rgw/rgw_multi/tests.py

index 0807677d5d8c3834c14e925cb6215d9199ee4f5e..29dab8322f38ae92d8a4e73fcaa9ae90ce42349e 100644 (file)
@@ -4,6 +4,7 @@ import string
 import sys
 import time
 import logging
+import errno
 
 try:
     from itertools import izip_longest as zip_longest
@@ -21,7 +22,7 @@ from nose.tools import eq_ as eq
 from nose.plugins.attrib import attr
 from nose.plugins.skip import SkipTest
 
-from .multisite import Zone
+from .multisite import Zone, ZoneGroup
 
 from .conn import get_gateway_connection
 
@@ -849,6 +850,34 @@ def test_zonegroup_remove():
     # validate the resulting period
     zonegroup.period.update(z1, commit=True)
 
+
+def test_zg_master_zone_delete():
+
+    master_zg = realm.master_zonegroup()
+    master_zone = master_zg.master_zone
+
+    assert(len(master_zg.zones) >= 1)
+    master_cluster = master_zg.zones[0].cluster
+
+    rm_zg = ZoneGroup('remove_zg')
+    rm_zg.create(master_cluster)
+
+    rm_zone = Zone('remove', rm_zg, master_cluster)
+    rm_zone.create(master_cluster)
+    master_zg.period.update(master_zone, commit=True)
+
+
+    rm_zone.delete(master_cluster)
+    # Period update: This should now fail as the zone will be the master zone
+    # in that zg
+    _, retcode = master_zg.period.update(master_zone, check_retcode=False)
+    assert(retcode == errno.EINVAL)
+
+    # Proceed to delete the zonegroup as well, previous period now does not
+    # contain a dangling master_zone, this must succeed
+    rm_zg.delete(master_cluster)
+    master_zg.period.update(master_zone, commit=True)
+
 def test_set_bucket_website():
     buckets, zone_bucket = create_bucket_per_zone_in_realm()
     for _, bucket in zone_bucket: