From: Adam King Date: Tue, 1 Nov 2022 19:35:52 +0000 (-0400) Subject: cephadm/tests: test for command_agent function X-Git-Tag: v18.1.0~552^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e5d3f57b9f4dcb5d0e2aaef547313562e0f78ae6;p=ceph.git cephadm/tests: test for command_agent function Part of: https://tracker.ceph.com/issues/57621 Signed-off-by: Adam King --- diff --git a/src/cephadm/tests/test_agent.py b/src/cephadm/tests/test_agent.py index c1c6ec792f38..f579729405a8 100644 --- a/src/cephadm/tests/test_agent.py +++ b/src/cephadm/tests/test_agent.py @@ -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()