]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: add mgr module selftest task
authorJohn Spray <john.spray@redhat.com>
Wed, 13 Sep 2017 21:16:54 +0000 (17:16 -0400)
committerJohn Spray <john.spray@redhat.com>
Wed, 1 Nov 2017 23:03:25 +0000 (23:03 +0000)
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 <john.spray@redhat.com>
(cherry picked from commit 99352ceced9d0fe92ddad6b97b1393b41de75d50)

qa/suites/rados/mgr/tasks/module_selftest.yaml [new file with mode: 0644]
qa/tasks/mgr/test_module_selftest.py [new file with mode: 0644]

diff --git a/qa/suites/rados/mgr/tasks/module_selftest.yaml b/qa/suites/rados/mgr/tasks/module_selftest.yaml
new file mode 100644 (file)
index 0000000..e9d90ff
--- /dev/null
@@ -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 (file)
index 0000000..4d2b74d
--- /dev/null
@@ -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")