mirror of
https://github.com/ceph/ceph
synced 2025-01-21 02:31:19 +00:00
mgr/dashboard: fix mgr module API tests
Signed-off-by: alfonsomthd <almartin@redhat.com>
This commit is contained in:
parent
cc3ae85b05
commit
6e6711a1e2
@ -12,11 +12,6 @@ logger = logging.getLogger(__name__)
|
|||||||
class MgrModuleTestCase(DashboardTestCase):
|
class MgrModuleTestCase(DashboardTestCase):
|
||||||
MGRS_REQUIRED = 1
|
MGRS_REQUIRED = 1
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def tearDownClass(cls):
|
|
||||||
cls._ceph_cmd(['mgr', 'module', 'disable', 'telemetry'])
|
|
||||||
super(MgrModuleTestCase, cls).tearDownClass()
|
|
||||||
|
|
||||||
def wait_until_rest_api_accessible(self):
|
def wait_until_rest_api_accessible(self):
|
||||||
"""
|
"""
|
||||||
Wait until the REST API is accessible.
|
Wait until the REST API is accessible.
|
||||||
@ -37,7 +32,7 @@ class MgrModuleTestCase(DashboardTestCase):
|
|||||||
|
|
||||||
class MgrModuleTest(MgrModuleTestCase):
|
class MgrModuleTest(MgrModuleTestCase):
|
||||||
def test_list_disabled_module(self):
|
def test_list_disabled_module(self):
|
||||||
self._ceph_cmd(['mgr', 'module', 'disable', 'telemetry'])
|
self._ceph_cmd(['mgr', 'module', 'disable', 'iostat'])
|
||||||
self.wait_until_rest_api_accessible()
|
self.wait_until_rest_api_accessible()
|
||||||
data = self._get('/api/mgr/module')
|
data = self._get('/api/mgr/module')
|
||||||
self.assertStatus(200)
|
self.assertStatus(200)
|
||||||
@ -65,12 +60,12 @@ class MgrModuleTest(MgrModuleTestCase):
|
|||||||
'tags': JList(str)
|
'tags': JList(str)
|
||||||
}))
|
}))
|
||||||
})))
|
})))
|
||||||
module_info = self.find_object_in_list('name', 'telemetry', data)
|
module_info = self.find_object_in_list('name', 'iostat', data)
|
||||||
self.assertIsNotNone(module_info)
|
self.assertIsNotNone(module_info)
|
||||||
self.assertFalse(module_info['enabled'])
|
self.assertFalse(module_info['enabled'])
|
||||||
|
|
||||||
def test_list_enabled_module(self):
|
def test_list_enabled_module(self):
|
||||||
self._ceph_cmd(['mgr', 'module', 'enable', 'telemetry'])
|
self._ceph_cmd(['mgr', 'module', 'enable', 'iostat'])
|
||||||
self.wait_until_rest_api_accessible()
|
self.wait_until_rest_api_accessible()
|
||||||
data = self._get('/api/mgr/module')
|
data = self._get('/api/mgr/module')
|
||||||
self.assertStatus(200)
|
self.assertStatus(200)
|
||||||
@ -98,7 +93,7 @@ class MgrModuleTest(MgrModuleTestCase):
|
|||||||
'tags': JList(str)
|
'tags': JList(str)
|
||||||
}))
|
}))
|
||||||
})))
|
})))
|
||||||
module_info = self.find_object_in_list('name', 'telemetry', data)
|
module_info = self.find_object_in_list('name', 'iostat', data)
|
||||||
self.assertIsNotNone(module_info)
|
self.assertIsNotNone(module_info)
|
||||||
self.assertTrue(module_info['enabled'])
|
self.assertTrue(module_info['enabled'])
|
||||||
|
|
||||||
@ -110,6 +105,7 @@ class MgrModuleTelemetryTest(MgrModuleTestCase):
|
|||||||
self.assertSchema(
|
self.assertSchema(
|
||||||
data,
|
data,
|
||||||
JObj(
|
JObj(
|
||||||
|
allow_unknown=True,
|
||||||
sub_elems={
|
sub_elems={
|
||||||
'channel_basic': bool,
|
'channel_basic': bool,
|
||||||
'channel_ident': bool,
|
'channel_ident': bool,
|
||||||
@ -119,6 +115,7 @@ class MgrModuleTelemetryTest(MgrModuleTestCase):
|
|||||||
'description': str,
|
'description': str,
|
||||||
'enabled': bool,
|
'enabled': bool,
|
||||||
'interval': int,
|
'interval': int,
|
||||||
|
'last_opt_revision': int,
|
||||||
'leaderboard': bool,
|
'leaderboard': bool,
|
||||||
'organization': str,
|
'organization': str,
|
||||||
'proxy': str,
|
'proxy': str,
|
||||||
|
Loading…
Reference in New Issue
Block a user