from __future__ import absolute_import
import logging
+
import requests
-from .helper import DashboardTestCase, JAny, JObj, JList, JLeaf
+from .helper import (DashboardTestCase, JLeaf, JList, JObj,
+ module_options_object_schema, module_options_schema)
logger = logging.getLogger(__name__)
class MgrModuleTest(MgrModuleTestCase):
- __options_schema = JObj({
- 'name': str,
- 'type': str,
- 'level': str,
- 'flags': int,
- 'default_value': JAny(none=True),
- 'min': JAny(none=False),
- 'max': JAny(none=False),
- 'enum_allowed': JList(str),
- 'desc': str,
- 'long_desc': str,
- 'tags': JList(str),
- 'see_also': JList(str)
- })
-
def test_list_disabled_module(self):
self._ceph_cmd(['mgr', 'module', 'disable', 'iostat'])
self.wait_until_rest_api_accessible()
'name': JLeaf(str),
'enabled': JLeaf(bool),
'always_on': JLeaf(bool),
- 'options': JObj(
- {},
- allow_unknown=True,
- unknown_schema=JObj({
- 'name': str,
- 'type': str,
- 'level': str,
- 'flags': int,
- 'default_value': JAny(none=True),
- 'min': JAny(none=False),
- 'max': JAny(none=False),
- 'enum_allowed': JList(str),
- 'see_also': JList(str),
- 'desc': str,
- 'long_desc': str,
- 'tags': JList(str)
- }))
+ 'options': module_options_schema
})))
module_info = self.find_object_in_list('name', 'iostat', data)
self.assertIsNotNone(module_info)
'name': JLeaf(str),
'enabled': JLeaf(bool),
'always_on': JLeaf(bool),
- 'options': JObj(
- {},
- allow_unknown=True,
- unknown_schema=JObj({
- 'name': str,
- 'type': str,
- 'level': str,
- 'flags': int,
- 'default_value': JAny(none=True),
- 'min': JAny(none=False),
- 'max': JAny(none=False),
- 'enum_allowed': JList(str),
- 'see_also': JList(str),
- 'desc': str,
- 'long_desc': str,
- 'tags': JList(str)
- }))
+ 'options': module_options_schema
})))
module_info = self.find_object_in_list('name', 'iostat', data)
self.assertIsNotNone(module_info)
'channel_ident': bool,
'channel_crash': bool,
'channel_device': bool,
+ 'channel_perf': bool,
'contact': str,
'description': str,
'enabled': bool,
data = self._get('/api/mgr/module/telemetry/options')
self.assertStatus(200)
schema = JObj({
- 'channel_basic': self.__options_schema,
- 'channel_crash': self.__options_schema,
- 'channel_device': self.__options_schema,
- 'channel_ident': self.__options_schema,
- 'contact': self.__options_schema,
- 'description': self.__options_schema,
- 'device_url': self.__options_schema,
- 'enabled': self.__options_schema,
- 'interval': self.__options_schema,
- 'last_opt_revision': self.__options_schema,
- 'leaderboard': self.__options_schema,
- 'log_level': self.__options_schema,
- 'log_to_cluster': self.__options_schema,
- 'log_to_cluster_level': self.__options_schema,
- 'log_to_file': self.__options_schema,
- 'organization': self.__options_schema,
- 'proxy': self.__options_schema,
- 'url': self.__options_schema
+ 'channel_basic': module_options_object_schema,
+ 'channel_crash': module_options_object_schema,
+ 'channel_device': module_options_object_schema,
+ 'channel_ident': module_options_object_schema,
+ 'channel_perf': module_options_object_schema,
+ 'contact': module_options_object_schema,
+ 'description': module_options_object_schema,
+ 'device_url': module_options_object_schema,
+ 'enabled': module_options_object_schema,
+ 'interval': module_options_object_schema,
+ 'last_opt_revision': module_options_object_schema,
+ 'leaderboard': module_options_object_schema,
+ 'log_level': module_options_object_schema,
+ 'log_to_cluster': module_options_object_schema,
+ 'log_to_cluster_level': module_options_object_schema,
+ 'log_to_file': module_options_object_schema,
+ 'organization': module_options_object_schema,
+ 'proxy': module_options_object_schema,
+ 'url': module_options_object_schema
})
self.assertSchema(data, schema)