]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: add unit tests for MgrMap down flag
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 10 Jan 2024 17:52:04 +0000 (12:52 -0500)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 10 Jan 2024 19:52:37 +0000 (14:52 -0500)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
qa/tasks/mgr/mgr_test_case.py
qa/tasks/mgr/test_cli.py [new file with mode: 0644]

index 275a567da29c2adc1e3436fa2fdb37903050af6f..b96f17d81f3871b3f4dd1217500a58c0789e42d7 100644 (file)
@@ -77,6 +77,8 @@ class MgrTestCase(CephTestCase):
         for daemon in cls.mgr_cluster.mgr_daemons.values():
             daemon.stop()
 
+        cls.mgr_cluster.mon_manager.raw_cluster_cmd("mgr", "set", "down", "false")
+
         for mgr_id in cls.mgr_cluster.mgr_ids:
             cls.mgr_cluster.mgr_fail(mgr_id)
 
diff --git a/qa/tasks/mgr/test_cli.py b/qa/tasks/mgr/test_cli.py
new file mode 100644 (file)
index 0000000..a43be90
--- /dev/null
@@ -0,0 +1,32 @@
+import logging
+
+from .mgr_test_case import MgrTestCase
+
+log = logging.getLogger(__name__)
+
+
+class TestCLI(MgrTestCase):
+    MGRS_REQUIRED = 2
+
+    def setUp(self):
+        super(TestCLI, self).setUp()
+        self.setup_mgrs()
+
+    def test_set_down(self):
+        """
+        That setting the down flag prevents a standby from promoting.
+        """
+
+        with self.assert_cluster_log("Activating manager daemon", present=False):
+            self.mgr_cluster.mon_manager.raw_cluster_cmd('mgr', 'set', 'down', 'true')
+            self.wait_until_true(lambda: self.mgr_cluster.get_active_id() == "", timeout=60)
+
+    def test_set_down_off(self):
+        """
+        That removing the down flag allows a standby to promote.
+        """
+
+        with self.assert_cluster_log("Activating manager daemon"):
+            self.mgr_cluster.mon_manager.raw_cluster_cmd('mgr', 'set', 'down', 'true')
+            self.wait_until_true(lambda: self.mgr_cluster.get_active_id() == "", timeout=60)
+            self.mgr_cluster.mon_manager.raw_cluster_cmd('mgr', 'set', 'down', 'false')