Skip to content

Commit d678644

Browse files
committed
mgr/cephadm/tests: handle "stop" daemon action in test_cephadm.py
Handle ok_to_stop logic for "stop" in test_daemon_action. Daemon "stop" needs force=true, so test for OrchestratorError when it's not passed. Signed-off-by: Vallari Agrawal <[email protected]>
1 parent 16bc30c commit d678644

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/pybind/mgr/cephadm/tests/test_cephadm.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,19 +393,20 @@ def test_daemon_action(self, cephadm_module: CephadmOrchestrator):
393393
assert wait(cephadm_module,
394394
c) == f"Scheduled to redeploy rgw.{daemon_id} on host 'test'"
395395

396-
for what in ('start', 'stop'):
397-
c = cephadm_module.daemon_action(what, d_name)
398-
assert wait(cephadm_module,
399-
c) == F"Scheduled to {what} {d_name} on host 'test'"
396+
c = cephadm_module.daemon_action('start', d_name)
397+
assert wait(cephadm_module,
398+
c) == F"Scheduled to start {d_name} on host 'test'"
400399

401400
for what in ('start', 'stop', 'restart'):
402401
c = cephadm_module.daemon_action(what, d_name, force=True)
403402
assert wait(cephadm_module,
404403
c) == F"Scheduled to {what} {d_name} on host 'test'"
405404

406-
with pytest.raises(OrchestratorError, match=f"Unable to restart daemon {d_name}"):
407-
c = cephadm_module.daemon_action('restart', d_name)
408-
wait(cephadm_module, c)
405+
for what in ('stop', 'restart'):
406+
with pytest.raises(OrchestratorError, match=f"Unable to {what} daemon {d_name}"):
407+
c = cephadm_module.daemon_action(what, d_name)
408+
wait(cephadm_module, c)
409+
409410
# Make sure, _check_daemons does a redeploy due to monmap change:
410411
cephadm_module._store['_ceph_get/mon_map'] = {
411412
'modified': datetime_to_str(datetime_now()),

0 commit comments

Comments
 (0)