]> git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/cephadm_cases/test_cli.py
import 15.2.5
[ceph.git] / ceph / qa / tasks / cephadm_cases / test_cli.py
1 import logging
2
3 from tasks.mgr.mgr_test_case import MgrTestCase
4
5 log = logging.getLogger(__name__)
6
7
8 class TestCephadmCLI(MgrTestCase):
9 def _cmd(self, *args):
10 return self.mgr_cluster.mon_manager.raw_cluster_cmd(*args)
11
12 def _orch_cmd(self, *args):
13 return self._cmd("orch", *args)
14
15 def setUp(self):
16 super(TestCephadmCLI, self).setUp()
17
18 def test_yaml(self):
19 """
20 to prevent oddities like
21
22 >>> import yaml
23 ... from collections import OrderedDict
24 ... assert yaml.dump(OrderedDict()) == '!!python/object/apply:collections.OrderedDict\\n- []\\n'
25 """
26 out = self._orch_cmd('device', 'ls', '--format', 'yaml')
27 self.assertNotIn('!!python', out)
28
29 out = self._orch_cmd('host', 'ls', '--format', 'yaml')
30 self.assertNotIn('!!python', out)
31
32 out = self._orch_cmd('ls', '--format', 'yaml')
33 self.assertNotIn('!!python', out)
34
35 out = self._orch_cmd('ps', '--format', 'yaml')
36 self.assertNotIn('!!python', out)
37
38 out = self._orch_cmd('status', '--format', 'yaml')
39 self.assertNotIn('!!python', out)
40
41 def test_pause(self):
42 self._orch_cmd('pause')
43 self.wait_for_health('CEPHADM_PAUSED', 30)
44 self._orch_cmd('resume')
45 self.wait_for_health_clear(30)
46
47 def test_daemon_restart(self):
48 self._orch_cmd('daemon', 'stop', 'osd.0')
49 self.wait_for_health('OSD_DOWN', 30)
50 self._orch_cmd('daemon', 'start', 'osd.0')
51 self.wait_for_health_clear(30)
52 self._orch_cmd('daemon', 'restart', 'osd.0')