]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/cephadm_cases/test_cli.py
c05395673c878222aa9b438b5f550325b7d9f671
5 from tasks
.mgr
.mgr_test_case
import MgrTestCase
6 from teuthology
.contextutil
import safe_while
8 log
= logging
.getLogger(__name__
)
11 class TestCephadmCLI(MgrTestCase
):
12 def _cmd(self
, *args
) -> str:
13 assert self
.mgr_cluster
is not None
14 return self
.mgr_cluster
.mon_manager
.raw_cluster_cmd(*args
)
16 def _orch_cmd(self
, *args
) -> str:
17 return self
._cmd
("orch", *args
)
20 super(TestCephadmCLI
, self
).setUp()
24 to prevent oddities like
27 ... from collections import OrderedDict
28 ... assert yaml.dump(OrderedDict()) == '!!python/object/apply:collections.OrderedDict\\n- []\\n'
30 out
= self
._orch
_cmd
('device', 'ls', '--format', 'yaml')
31 self
.assertNotIn('!!python', out
)
33 out
= self
._orch
_cmd
('host', 'ls', '--format', 'yaml')
34 self
.assertNotIn('!!python', out
)
36 out
= self
._orch
_cmd
('ls', '--format', 'yaml')
37 self
.assertNotIn('!!python', out
)
39 out
= self
._orch
_cmd
('ps', '--format', 'yaml')
40 self
.assertNotIn('!!python', out
)
42 out
= self
._orch
_cmd
('status', '--format', 'yaml')
43 self
.assertNotIn('!!python', out
)
46 self
._orch
_cmd
('pause')
47 self
.wait_for_health('CEPHADM_PAUSED', 30)
48 self
._orch
_cmd
('resume')
49 self
.wait_for_health_clear(30)
51 def test_daemon_restart(self
):
52 self
._orch
_cmd
('daemon', 'stop', 'osd.0')
53 self
.wait_for_health('OSD_DOWN', 30)
54 with
safe_while(sleep
=1, tries
=30) as proceed
:
56 j
= json
.loads(self
._orch
_cmd
('ps', '--format', 'json'))
57 d
= {d
['daemon_name']: d
for d
in j
}
58 if d
['osd.0']['status_desc'] != 'running':
61 self
._orch
_cmd
('daemon', 'start', 'osd.0')
62 self
.wait_for_health_clear(90)
63 self
._orch
_cmd
('daemon', 'restart', 'osd.0')
65 def test_device_ls_wide(self
):
66 self
._orch
_cmd
('device', 'ls', '--wide')
68 def test_cephfs_mirror(self
):
69 self
._orch
_cmd
('apply', 'cephfs-mirror')
70 self
.wait_until_true(lambda: 'cephfs-mirror' in self
._orch
_cmd
('ps'), 30)
71 self
.wait_for_health_clear(30)
72 self
._orch
_cmd
('rm', 'cephfs-mirror')
73 self
.wait_until_true(lambda: 'cephfs-mirror' not in self
._orch
_cmd
('ps'), 30)