From f073fc4663db17ea44e9c36831d21df1597d193a Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 13 Sep 2017 17:16:54 -0400 Subject: [PATCH] qa: add mgr module selftest task The module self test commands give us a chance to catch any other ceph changes that change something that a module was relying on reading. Signed-off-by: John Spray (cherry picked from commit 99352ceced9d0fe92ddad6b97b1393b41de75d50) --- .../rados/mgr/tasks/module_selftest.yaml | 16 ++++++++ qa/tasks/mgr/test_module_selftest.py | 38 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 qa/suites/rados/mgr/tasks/module_selftest.yaml create mode 100644 qa/tasks/mgr/test_module_selftest.py diff --git a/qa/suites/rados/mgr/tasks/module_selftest.yaml b/qa/suites/rados/mgr/tasks/module_selftest.yaml new file mode 100644 index 0000000000000..e9d90ffb1be05 --- /dev/null +++ b/qa/suites/rados/mgr/tasks/module_selftest.yaml @@ -0,0 +1,16 @@ + +tasks: + - install: + - ceph: + # tests may leave mgrs broken, so don't try and call into them + # to invoke e.g. pg dump during teardown. + wait-for-scrub: false + log-whitelist: + - overall HEALTH_ + - \(MGR_DOWN\) + - \(PG_ + - replacing it with standby + - No standby daemons available + - cephfs_test_runner: + modules: + - tasks.mgr.test_module_selftest diff --git a/qa/tasks/mgr/test_module_selftest.py b/qa/tasks/mgr/test_module_selftest.py new file mode 100644 index 0000000000000..4d2b74d842326 --- /dev/null +++ b/qa/tasks/mgr/test_module_selftest.py @@ -0,0 +1,38 @@ + +from tasks.mgr.mgr_test_case import MgrTestCase + + +class TestModuleSelftest(MgrTestCase): + """ + That modules with a self-test command can be loaded and execute it + without errors. + + This is not a substitute for really testing the modules, but it + is quick and is designed to catch regressions that could occur + if data structures change in a way that breaks how the modules + touch them. + """ + MGRS_REQUIRED = 1 + + def _selftest_plugin(self, plugin_name): + initial_gid = self.mgr_cluster.get_mgr_map()['active_gid'] + self.mgr_cluster.mon_manager.raw_cluster_cmd("mgr", "module", "enable", + plugin_name) + + # Wait for the module to load + def has_restarted(): + map = self.mgr_cluster.get_mgr_map() + return map['active_gid'] != initial_gid and map['available'] + self.wait_until_true(has_restarted, timeout=30) + + # Execute the module's self-test routine + self.mgr_cluster.mon_manager.raw_cluster_cmd(plugin_name, "self-test") + + def test_zabbix(self): + self._selftest_plugin("zabbix") + + def test_prometheus(self): + self._selftest_plugin("influx") + + def test_influx(self): + self._selftest_plugin("prometheus") -- 2.39.5