]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm/tests: handle "stop" daemon action in test_cephadm.py 64368/head
authorVallari Agrawal <vallari.agrawal@ibm.com>
Thu, 10 Apr 2025 06:22:59 +0000 (11:52 +0530)
committerVallari Agrawal <vallari.agrawal@ibm.com>
Mon, 7 Jul 2025 11:55:43 +0000 (17:25 +0530)
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 <vallari.agrawal@ibm.com>
(cherry picked from commit d67864476a1f002c7fc4c5f128b0bd64ef2eac43)

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

index 946d165c702cb03aefa85aaaa1db5e24da1f8a2f..552764e97845ff6a5805153406c6989f9675c173 100644 (file)
@@ -394,19 +394,20 @@ class TestCephadm(object):
                 assert wait(cephadm_module,
                             c) == f"Scheduled to redeploy rgw.{daemon_id} on host 'test'"
 
-                for what in ('start', 'stop'):
-                    c = cephadm_module.daemon_action(what, d_name)
-                    assert wait(cephadm_module,
-                                c) == F"Scheduled to {what} {d_name} on host 'test'"
+                c = cephadm_module.daemon_action('start', d_name)
+                assert wait(cephadm_module,
+                            c) == F"Scheduled to start {d_name} on host 'test'"
 
                 for what in ('start', 'stop', 'restart'):
                     c = cephadm_module.daemon_action(what, d_name, force=True)
                     assert wait(cephadm_module,
                                 c) == F"Scheduled to {what} {d_name} on host 'test'"
 
-                with pytest.raises(OrchestratorError, match=f"Unable to restart daemon {d_name}"):
-                    c = cephadm_module.daemon_action('restart', d_name)
-                    wait(cephadm_module, c)
+                for what in ('stop', 'restart'):
+                    with pytest.raises(OrchestratorError, match=f"Unable to {what} daemon {d_name}"):
+                        c = cephadm_module.daemon_action(what, d_name)
+                        wait(cephadm_module, c)
+
                 # Make sure, _check_daemons does a redeploy due to monmap change:
                 cephadm_module._store['_ceph_get/mon_map'] = {
                     'modified': datetime_to_str(datetime_now()),