diff options
author | John Mulligan <jmulligan@redhat.com> | 2023-11-19 21:39:52 +0100 |
---|---|---|
committer | John Mulligan <jmulligan@redhat.com> | 2024-01-02 15:30:21 +0100 |
commit | 43fd3deb1d8b19e1ac14aeecfbafcb3ab7d424c7 (patch) | |
tree | db26465864fccba75998f94ed0b506c1839ca739 /src/cephadm/tests/test_deploy.py | |
parent | cephadm: update rm cluster to remove sidecar/init-ctr services (diff) | |
download | ceph-43fd3deb1d8b19e1ac14aeecfbafcb3ab7d424c7.tar.xz ceph-43fd3deb1d8b19e1ac14aeecfbafcb3ab7d424c7.zip |
cephadm: add a unit test to check sidecar removal
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | src/cephadm/tests/test_deploy.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/cephadm/tests/test_deploy.py b/src/cephadm/tests/test_deploy.py index dadf3456fd5..cfde3fbce0a 100644 --- a/src/cephadm/tests/test_deploy.py +++ b/src/cephadm/tests/test_deploy.py @@ -488,3 +488,47 @@ def test_deploy_ceph_exporter_container(cephadm_fs, funkypatch): assert f.read() == 'XXXXXXX' with open(basedir / 'keyring') as f: assert f.read() == 'YYYYYY' + + +def test_deploy_and_rm_iscsi(cephadm_fs, funkypatch): + # Test that the deploy and remove paths for iscsi (which has sidecar container) + # create and remove the correct unit files. + mocks = _common_patches(funkypatch) + _firewalld = mocks['Firewalld'] + fsid = 'b01dbeef-701d-9abe-0000-e1e5a47004a7' + with with_cephadm_ctx([]) as ctx: + ctx.container_engine = mock_podman() + ctx.fsid = fsid + ctx.name = 'iscsi.wuzzy' + ctx.image = 'quay.io/ayeaye/iscsi:latest' + ctx.reconfig = False + ctx.config_blobs = { + 'config': 'XXXXXXX', + 'keyring': 'YYYYYY', + 'files': { + 'iscsi-gateway.cfg': 'portal', + }, + } + _cephadm._common_deploy(ctx) + + unit_dir = pathlib.Path('/etc/systemd/system') + assert unit_dir.is_dir() + assert (unit_dir / f'ceph-{fsid}@.service').exists() + drop_in = unit_dir / f'ceph-{fsid}@iscsi.wuzzy.service.d/99-cephadm.conf' + assert drop_in.parent.is_dir() + assert drop_in.exists() + assert 'tcmu' in drop_in.read_text() + tcmu_sidecar = unit_dir / f'ceph-{fsid}-sidecar@iscsi.wuzzy:tcmu.service' + assert tcmu_sidecar.exists() + assert 'sidecar-tcmu.run' in tcmu_sidecar.read_text() + + with with_cephadm_ctx([]) as ctx: + ctx.container_engine = mock_podman() + ctx.fsid = fsid + ctx.name = 'iscsi.wuzzy' + ctx.image = 'quay.io/ayeaye/iscsi:latest' + _cephadm.command_rm_daemon(ctx) + + assert not drop_in.exists() + assert not drop_in.parent.exists() + assert not tcmu_sidecar.exists() |