]> git.proxmox.com Git - ceph.git/blobdiff - ceph/qa/tasks/mgr/test_dashboard.py
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / qa / tasks / mgr / test_dashboard.py
index 3b8a2cc80c1d80edd910fa983560e37e28a0aebd..3b778520da872f93f15aea1f28151b3b56e358de 100644 (file)
@@ -12,32 +12,41 @@ log = logging.getLogger(__name__)
 class TestDashboard(MgrTestCase):
     MGRS_REQUIRED = 3
 
-    def test_standby(self):
-        self._assign_ports("dashboard", "server_port")
-        self._load_module("dashboard")
+    def setUp(self):
+        super(TestDashboard, self).setUp()
 
-        original_active = self.mgr_cluster.get_active_id()
+        self._assign_ports("dashboard", "ssl_server_port")
+        self._load_module("dashboard")
+        self.mgr_cluster.mon_manager.raw_cluster_cmd("dashboard",
+                                                     "create-self-signed-cert")
 
+    def test_standby(self):
+        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(original_uri))
+        log.info("After failover running manager '{}' at {}".format(
+            failed_active_id, failed_over_uri))
 
         self.assertNotEqual(original_uri, failed_over_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)
+        r = requests.get(original_uri, allow_redirects=False, verify=False)
         self.assertEqual(r.status_code, 303)
         self.assertEqual(r.headers['Location'], failed_over_uri)
 
     def test_urls(self):
-        self._assign_ports("dashboard", "server_port")
-        self._load_module("dashboard")
-
         base_uri = self._get_uri("dashboard")
 
         # This is a very simple smoke test to check that the dashboard can
@@ -45,18 +54,14 @@ class TestDashboard(MgrTestCase):
         # the content is correct or even renders!
 
         urls = [
-            "/health",
-            "/servers",
-            "/osd/",
-            "/osd/perf/0",
-            "/rbd_mirroring",
-            "/rbd_iscsi"
+            "/",
         ]
 
         failures = []
 
         for url in urls:
-            r = requests.get(base_uri + url, allow_redirects=False)
+            r = requests.get(base_uri + url, allow_redirects=False,
+                             verify=False)
             if r.status_code >= 300 and r.status_code < 400:
                 log.error("Unexpected redirect to: {0} (from {1})".format(
                     r.headers['Location'], base_uri))