]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/mgr: extract module_info_schema and reused it
authorKefu Chai <kchai@redhat.com>
Thu, 3 Jan 2019 03:00:31 +0000 (11:00 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 3 Jan 2019 03:01:04 +0000 (11:01 +0800)
both standby mgr and active mgr have this sub-schema. so extract it out
and reuse it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/tasks/mgr/dashboard/test_health.py

index 12d9bdba6f0e72eadf7ca13c21ef79c31a445895..f42781e187feb5580e7a5e271b79728b151d7cf2 100644 (file)
@@ -78,6 +78,11 @@ class HealthTest(DashboardTestCase):
     def test_full_health(self):
         data = self._get('/api/health/full')
         self.assertStatus(200)
+        module_info_schema = JObj({
+            'can_run': bool,
+            'error_string': str,
+            'name': str
+        })
         schema = JObj({
             'client_perf': JObj({
                 'read_bytes_sec': int,
@@ -169,11 +174,7 @@ class HealthTest(DashboardTestCase):
                     allow_unknown=True, unknown_schema=JList(str)
                 ),
                 'available': bool,
-                'available_modules': JList(JObj({
-                    'can_run': bool,
-                    'error_string': str,
-                    'name': str
-                })),
+                'available_modules': JList(module_info_schema),
                 'epoch': int,
                 'modules': JList(str),
                 'services': JObj(
@@ -181,11 +182,7 @@ class HealthTest(DashboardTestCase):
                     allow_unknown=True, unknown_schema=str
                 ),
                 'standbys': JList(JObj({
-                    'available_modules': JList(JObj({
-                        'can_run': bool,
-                        'error_string': str,
-                        'name': str
-                    })),
+                    'available_modules': JList(module_info_schema),
                     'gid': int,
                     'name': str
                 }))