From: Adam King Date: Wed, 5 May 2021 17:59:54 +0000 (-0400) Subject: mgr/cephadm: mock subprocess calls in tests that remove iscsi daemons X-Git-Tag: v17.1.0~2007^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c5b984b10c2d6f2eef02e9dbf74aea64bf11f19a;p=ceph.git mgr/cephadm: mock subprocess calls in tests that remove iscsi daemons tests that remove iscsi daemons use subprocess.run to make a call to rados to clear out the gateway.conf. We don't want the tests to actually make that call. Signed-off-by: Adam King --- diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index 83df09ff4c77..2fea77eb3cba 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -770,6 +770,7 @@ class TestCephadm(object): assert_rm_daemon(cephadm_module, 'nfs.name.test', 'test') @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}')) + @mock.patch("subprocess.run", None) @mock.patch("cephadm.module.CephadmOrchestrator.rados", mock.MagicMock()) def test_iscsi(self, cephadm_module): with with_host(cephadm_module, 'test'): @@ -909,6 +910,7 @@ class TestCephadm(object): ] ) @mock.patch("cephadm.serve.CephadmServe._deploy_cephadm_binary", _deploy_cephadm_binary('test')) + @mock.patch("subprocess.run", None) @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}')) def test_apply_save(self, spec: ServiceSpec, meth, cephadm_module: CephadmOrchestrator): with with_host(cephadm_module, 'test'):