From: Volker Theile Date: Thu, 3 Dec 2020 13:58:10 +0000 (+0100) Subject: mgr/dashboard: test_standby* (tasks.mgr.test_dashboard.TestDashboard) failed locally X-Git-Tag: v14.2.17~104^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=34ae5e9e21f85e4c6ced21da949450e7505ad092;p=ceph.git mgr/dashboard: test_standby* (tasks.mgr.test_dashboard.TestDashboard) failed locally Fixes: https://tracker.ceph.com/issues/48449 Signed-off-by: Volker Theile (cherry picked from commit 9d4282e53af6c4a4c48641deeaa5f018781d5006) --- diff --git a/qa/tasks/mgr/test_dashboard.py b/qa/tasks/mgr/test_dashboard.py index 5e9b3829b2a6e..41b26ad807e28 100644 --- a/qa/tasks/mgr/test_dashboard.py +++ b/qa/tasks/mgr/test_dashboard.py @@ -26,6 +26,16 @@ class TestDashboard(MgrTestCase): "mgr/dashboard/standby_error_status_code", "500") + def wait_until_webserver_available(self, url): + def _check_connection(): + try: + requests.get(url, allow_redirects=False, verify=False) + return True + except requests.ConnectionError: + pass + return False + self.wait_until_true(_check_connection, timeout=30) + def test_standby(self): original_active_id = self.mgr_cluster.get_active_id() original_uri = self._get_uri("dashboard") @@ -46,6 +56,9 @@ class TestDashboard(MgrTestCase): self.assertNotEqual(original_uri, failed_over_uri) + # Wait until web server of the standby node is settled. + self.wait_until_webserver_available(original_uri) + # The original active daemon should have come back up as a standby # and be doing redirects to the new active daemon. r = requests.get(original_uri, allow_redirects=False, verify=False) @@ -53,7 +66,7 @@ class TestDashboard(MgrTestCase): self.assertEqual(r.headers['Location'], failed_over_uri) # Ensure that every URL redirects to the active daemon. - r = requests.get("{}/runtime.js".format(original_uri), + r = requests.get("{}/runtime.js".format(original_uri.strip('/')), allow_redirects=False, verify=False) self.assertEqual(r.status_code, 303) @@ -83,6 +96,9 @@ class TestDashboard(MgrTestCase): self.assertNotEqual(original_uri, failed_over_uri) + # Wait until web server of the standby node is settled. + self.wait_until_webserver_available(original_uri) + # Redirection should be disabled now, instead a 500 must be returned. r = requests.get(original_uri, allow_redirects=False, verify=False) self.assertEqual(r.status_code, 500)