diff options
author | John Mulligan <jmulligan@redhat.com> | 2023-11-19 01:09:29 +0100 |
---|---|---|
committer | John Mulligan <jmulligan@redhat.com> | 2024-01-02 15:30:21 +0100 |
commit | 0f7a48cc4dc620e388f87a083504664552705758 (patch) | |
tree | a359e7406856ae40fe86748e427d92b8aab8a2d9 /src/cephadm/tests/test_cephadm.py | |
parent | cephadm: add support to remove sidecar/init-ctr systemd units (diff) | |
download | ceph-0f7a48cc4dc620e388f87a083504664552705758.tar.xz ceph-0f7a48cc4dc620e388f87a083504664552705758.zip |
cephadm: update _rm_cluster to call terminate_service
The terminate_service function was added to encapsulate the act of
terminating a systemd service. The rm-deamon handler was updated to use
this function previously; this commit updates rm-cluster function(s)
to do the same. This needed a bunch of test updates do to how the tests
were mocking commands.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Diffstat (limited to 'src/cephadm/tests/test_cephadm.py')
-rw-r--r-- | src/cephadm/tests/test_cephadm.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/cephadm/tests/test_cephadm.py b/src/cephadm/tests/test_cephadm.py index 7bca8b9cbf3..9c6caf0092b 100644 --- a/src/cephadm/tests/test_cephadm.py +++ b/src/cephadm/tests/test_cephadm.py @@ -1345,7 +1345,9 @@ class TestBootstrap(object): ###############################################3 - def test_config(self, cephadm_fs): + def test_config(self, cephadm_fs, funkypatch): + funkypatch.patch('cephadmlib.systemd.call') + conf_file = 'foo' cmd = self._get_cmd( '--mon-ip', '192.168.1.1', @@ -1363,14 +1365,17 @@ class TestBootstrap(object): retval = _cephadm.command_bootstrap(ctx) assert retval == 0 - def test_no_mon_addr(self, cephadm_fs): + def test_no_mon_addr(self, cephadm_fs, funkypatch): + funkypatch.patch('cephadmlib.systemd.call') + cmd = self._get_cmd() with with_cephadm_ctx(cmd) as ctx: msg = r'must specify --mon-ip or --mon-addrv' with pytest.raises(_cephadm.Error, match=msg): _cephadm.command_bootstrap(ctx) - def test_skip_mon_network(self, cephadm_fs): + def test_skip_mon_network(self, cephadm_fs, funkypatch): + funkypatch.patch('cephadmlib.systemd.call') cmd = self._get_cmd('--mon-ip', '192.168.1.1') with with_cephadm_ctx(cmd, list_networks={}) as ctx: @@ -1453,7 +1458,9 @@ class TestBootstrap(object): True, ), ]) - def test_mon_ip(self, mon_ip, list_networks, result, cephadm_fs): + def test_mon_ip(self, mon_ip, list_networks, result, cephadm_fs, funkypatch): + funkypatch.patch('cephadmlib.systemd.call') + cmd = self._get_cmd('--mon-ip', mon_ip) if not result: with with_cephadm_ctx(cmd, list_networks=list_networks) as ctx: @@ -1515,7 +1522,9 @@ class TestBootstrap(object): None, ), ]) - def test_mon_addrv(self, mon_addrv, list_networks, err, cephadm_fs): + def test_mon_addrv(self, mon_addrv, list_networks, err, cephadm_fs, funkypatch): + funkypatch.patch('cephadmlib.systemd.call') + cmd = self._get_cmd('--mon-addrv', mon_addrv) if err: with with_cephadm_ctx(cmd, list_networks=list_networks) as ctx: @@ -1526,7 +1535,9 @@ class TestBootstrap(object): retval = _cephadm.command_bootstrap(ctx) assert retval == 0 - def test_allow_fqdn_hostname(self, cephadm_fs): + def test_allow_fqdn_hostname(self, cephadm_fs, funkypatch): + funkypatch.patch('cephadmlib.systemd.call') + hostname = 'foo.bar' cmd = self._get_cmd( '--mon-ip', '192.168.1.1', @@ -1549,7 +1560,9 @@ class TestBootstrap(object): ('00000000-0000-0000-0000-0000deadbeef', None), ('00000000-0000-0000-0000-0000deadbeez', 'not an fsid'), ]) - def test_fsid(self, fsid, err, cephadm_fs): + def test_fsid(self, fsid, err, cephadm_fs, funkypatch): + funkypatch.patch('cephadmlib.systemd.call') + cmd = self._get_cmd( '--mon-ip', '192.168.1.1', '--skip-mon-network', |