From: Patrick Donnelly Date: Wed, 10 Jan 2024 17:52:04 +0000 (-0500) Subject: qa: add unit tests for MgrMap down flag X-Git-Tag: v17.2.8~397^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6f9d9de97c2d814d1abc17d8b9f786e4d36f3b65;p=ceph.git qa: add unit tests for MgrMap down flag Signed-off-by: Patrick Donnelly (cherry picked from commit 9ebcbdbed0fbaf37d60fbd8db321742ee5721d8c) --- diff --git a/qa/tasks/mgr/mgr_test_case.py b/qa/tasks/mgr/mgr_test_case.py index 275a567da29..b96f17d81f3 100644 --- a/qa/tasks/mgr/mgr_test_case.py +++ b/qa/tasks/mgr/mgr_test_case.py @@ -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 index 00000000000..a43be90ea03 --- /dev/null +++ b/qa/tasks/mgr/test_cli.py @@ -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')