diff --git a/src/cephadm/tests/test_deploy.py b/src/cephadm/tests/test_deploy.py index 8ddf41a9b083c7..a76d3ec256224e 100644 --- a/src/cephadm/tests/test_deploy.py +++ b/src/cephadm/tests/test_deploy.py @@ -532,3 +532,33 @@ def test_deploy_and_rm_iscsi(cephadm_fs, funkypatch): assert not drop_in.exists() assert not drop_in.parent.exists() assert not tcmu_sidecar.exists() + + +def test_deploy_smb_container(cephadm_fs, funkypatch): + mocks = _common_patches(funkypatch) + fsid = 'b01dbeef-701d-9abe-0000-e1e5a47004a7' + with with_cephadm_ctx([]) as ctx: + ctx.container_engine = mock_podman() + ctx.fsid = fsid + ctx.name = 'smb.b01s' + ctx.image = 'quay.io/essembee/samba-server:latest' + ctx.reconfig = False + ctx.config_blobs = { + 'cluster_id': 'smb1', + 'config_uri': 'http://localhost:9876/smb.json', + 'config': 'SAMPLE', + 'keyring': 'SOMETHING', + } + _cephadm._common_deploy(ctx) + + basedir = pathlib.Path(f'/var/lib/ceph/{fsid}/smb.b01s') + assert basedir.is_dir() + with open(basedir / 'unit.run') as f: + runfile_lines = f.read().splitlines() + assert 'podman' in runfile_lines[-1] + assert runfile_lines[-1].endswith('quay.io/essembee/samba-server:latest --samba-debug-level=6 run smbd') + assert f'-v {basedir}/etc-samba-container:/etc/samba/container:z' in runfile_lines[-1] + assert f'-v {basedir}/lib-samba:/var/lib/samba:z' in runfile_lines[-1] + assert '-e SAMBA_CONTAINER_ID=smb1' in runfile_lines[-1] + assert '-e \'SAMBACC_CONFIG=["http://localhost:9876/smb.json"]\'' in runfile_lines[-1] + assert '--publish' in runfile_lines[-1]