]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm/tests: test for command_agent function 48696/head
authorAdam King <adking@redhat.com>
Tue, 1 Nov 2022 19:35:52 +0000 (15:35 -0400)
committerAdam King <adking@redhat.com>
Wed, 30 Nov 2022 17:00:36 +0000 (12:00 -0500)
Part of: https://tracker.ceph.com/issues/57621

Signed-off-by: Adam King <adking@redhat.com>
src/cephadm/tests/test_agent.py

index c1c6ec792f3842e7fd017ada4ecd78fcc22872e3..f579729405a891b87fa387590499fc81bf1a1ec0 100644 (file)
@@ -784,3 +784,17 @@ def test_gatherer_run(_wait, _time, _agent_wakeup, cephadm_fs):
             assert agent.ls_gatherer.ack == agent.ack
             # should not have gotten to end of loop
             _clear.assert_not_called()
+
+
+@mock.patch("cephadm.CephadmAgent.run")
+def test_command_agent(_agent_run, cephadm_fs):
+    with with_cephadm_ctx([]) as ctx:
+        ctx.fsid = FSID
+        ctx.daemon_id = AGENT_ID
+
+        with pytest.raises(Exception, match=f"Agent daemon directory {AGENT_DIR} does not exist. Perhaps agent was never deployed?"):
+            _cephadm.command_agent(ctx)
+
+        cephadm_fs.create_dir(AGENT_DIR)
+        _cephadm.command_agent(ctx)
+        _agent_run.assert_called()