]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/mgr/test_module_selftest.py
5 from tasks
.mgr
.mgr_test_case
import MgrTestCase
8 class TestModuleSelftest(MgrTestCase
):
10 That modules with a self-test command can be loaded and execute it
13 This is not a substitute for really testing the modules, but it
14 is quick and is designed to catch regressions that could occur
15 if data structures change in a way that breaks how the modules
20 def _selftest_plugin(self
, module_name
):
21 self
._load
_module
(module_name
)
23 # Execute the module's self-test routine
24 self
.mgr_cluster
.mon_manager
.raw_cluster_cmd(module_name
, "self-test")
26 def test_zabbix(self
):
27 # Set these mandatory config fields so that the zabbix module
28 # won't trigger health/log errors on load/serve.
29 self
.mgr_cluster
.set_module_conf("zabbix", "zabbix_host", "localhost")
30 self
.mgr_cluster
.set_module_conf("zabbix", "identifier", "foo")
31 self
._selftest
_plugin
("zabbix")
33 def test_prometheus(self
):
34 self
._selftest
_plugin
("prometheus")
36 def test_influx(self
):
37 self
._selftest
_plugin
("influx")
39 def test_selftest_run(self
):
40 self
._load
_module
("selftest")
41 self
.mgr_cluster
.mon_manager
.raw_cluster_cmd("mgr", "self-test", "run")
43 def test_selftest_command_spam(self
):
44 # Use the selftest module to stress the mgr daemon
45 self
._load
_module
("selftest")
47 # Use the dashboard to test that the mgr is still able to do its job
48 self
._assign
_ports
("dashboard", "server_port")
49 self
._load
_module
("dashboard")
51 original_active
= self
.mgr_cluster
.get_active_id()
52 original_standbys
= self
.mgr_cluster
.get_standby_ids()
54 self
.mgr_cluster
.mon_manager
.raw_cluster_cmd("mgr", "self-test",
55 "background", "start",
58 dashboard_uri
= self
._get
_uri
("dashboard")
62 for i
in range(0, periods
):
64 # Check that an HTTP module remains responsive
65 r
= requests
.get(dashboard_uri
)
66 self
.assertEqual(r
.status_code
, 200)
68 # Check that a native non-module command remains responsive
69 self
.mgr_cluster
.mon_manager
.raw_cluster_cmd("osd", "df")
71 time
.sleep(delay
- (time
.time() - t1
))
73 self
.mgr_cluster
.mon_manager
.raw_cluster_cmd("mgr", "self-test",
76 # Check that all mgr daemons are still running
77 self
.assertEqual(original_active
, self
.mgr_cluster
.get_active_id())
78 self
.assertEqual(original_standbys
, self
.mgr_cluster
.get_standby_ids())