Skip to content

Commit

Permalink
cephadm: add a basic deployment test for an smb daemon
Browse files Browse the repository at this point in the history
Signed-off-by: John Mulligan <jmulligan@redhat.com>
  • Loading branch information
phlogistonjohn committed Mar 21, 2024
1 parent f86e710 commit 3b0f331
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/cephadm/tests/test_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,3 +534,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]

0 comments on commit 3b0f331

Please sign in to comment.