From: Volker Theile Date: Wed, 13 Mar 2019 10:39:49 +0000 (+0100) Subject: mgr/dashboard/qa: Improve tasks.mgr.test_dashboard.TestDashboard.test_standby X-Git-Tag: v14.2.1~96^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F27237%2Fhead;p=ceph.git mgr/dashboard/qa: Improve tasks.mgr.test_dashboard.TestDashboard.test_standby The changes of this PR were done while trying to fix the failing test. The problem has been solved by another PR, but the changes are worth to be integrated because they help debugging and an additional test has been added (check if previously active manager is listed as standby). Signed-off-by: Volker Theile (cherry picked from commit c29e587007e461738d4f95938dc2eb44f2459964) --- diff --git a/qa/tasks/mgr/mgr_test_case.py b/qa/tasks/mgr/mgr_test_case.py index 4f319ed1eb567..7684a95565af7 100644 --- a/qa/tasks/mgr/mgr_test_case.py +++ b/qa/tasks/mgr/mgr_test_case.py @@ -199,6 +199,6 @@ class MgrTestCase(CephTestCase): done = mgr_map['available'] if done: log.info("Available after assign ports (new active {0}/{1})".format( - mgr_map['active_name'] , mgr_map['active_gid'])) + mgr_map['active_name'], mgr_map['active_gid'])) return done cls.wait_until_true(is_available, timeout=30) diff --git a/qa/tasks/mgr/test_dashboard.py b/qa/tasks/mgr/test_dashboard.py index 6a98e0ec4b2a0..44d632b1f3822 100644 --- a/qa/tasks/mgr/test_dashboard.py +++ b/qa/tasks/mgr/test_dashboard.py @@ -21,15 +21,22 @@ class TestDashboard(MgrTestCase): "create-self-signed-cert") def test_standby(self): - original_active = self.mgr_cluster.get_active_id() - + original_active_id = self.mgr_cluster.get_active_id() original_uri = self._get_uri("dashboard") - log.info("Originally running at {0}".format(original_uri)) + log.info("Originally running manager '{}' at {}".format( + original_active_id, original_uri)) - self.mgr_cluster.mgr_fail(original_active) + # Force a failover and wait until the previously active manager + # is listed as standby. + self.mgr_cluster.mgr_fail(original_active_id) + self.wait_until_true( + lambda: original_active_id in self.mgr_cluster.get_standby_ids(), + timeout=30) + failed_active_id = self.mgr_cluster.get_active_id() failed_over_uri = self._get_uri("dashboard") - log.info("After failover running at {0}".format(failed_over_uri)) + log.info("After failover running manager '{}' at {}".format( + failed_active_id, failed_over_uri)) self.assertNotEqual(original_uri, failed_over_uri) diff --git a/src/pybind/mgr/dashboard/module.py b/src/pybind/mgr/dashboard/module.py index 6be074d2a49aa..b236a1ac024ad 100644 --- a/src/pybind/mgr/dashboard/module.py +++ b/src/pybind/mgr/dashboard/module.py @@ -449,7 +449,7 @@ class StandbyModule(MgrStandbyModule, CherryPyConfig): No active ceph-mgr instance is currently running - the dashboard. A failover may be in progress. + the dashboard. A failover may be in progress. Retrying in {delay} seconds...