]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add a basic deployment test for an smb daemon
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 6 Dec 2023 20:14:32 +0000 (15:14 -0500)
committerAdam King <adking@redhat.com>
Mon, 15 Apr 2024 15:01:29 +0000 (11:01 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 3b0f33188abef97d8e6ff774b03947ba23e180d0)

src/cephadm/tests/test_deploy.py

index fc2bbe4b3e3d872f689b238e70c1c588e9838756..d78bf932df6c341b54eada3df6be4a096e90e2c1 100644 (file)
@@ -533,3 +533,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]