]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm/tests: handle "stop" daemon action in test_cephadm.py 62745/head
authorVallari Agrawal <vallari.agrawal@ibm.com>
Thu, 10 Apr 2025 06:22:59 +0000 (11:52 +0530)
committerVallari Agrawal <vallari.agrawal@ibm.com>
Thu, 10 Apr 2025 16:08:56 +0000 (21:38 +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>
src/pybind/mgr/cephadm/tests/test_cephadm.py

index 87fe08633fa5861d46b9c530f2a091c689fd25e0..a1cebc0b7789df66d2c15e68c6609398c920df9f 100644 (file)
@@ -393,19 +393,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()),