]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/cephadm: add test_deploy_custom_container test case
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 21 Jun 2023 20:44:22 +0000 (16:44 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 9 Aug 2023 17:48:07 +0000 (13:48 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/cephadm/tests/test_services.py

index 3b7a3570ffcf3273c629a0dbf3c12a2347c1d6b8..b0f9743ce6ccc2302f061aa3e0b0a1be6ad46303 100644 (file)
@@ -21,6 +21,7 @@ from cephadm.module import CephadmOrchestrator
 from ceph.deployment.service_spec import (
     AlertManagerSpec,
     CephExporterSpec,
+    CustomContainerSpec,
     GrafanaSpec,
     IngressSpec,
     IscsiServiceSpec,
@@ -2500,3 +2501,59 @@ class TestJaeger:
                             "config_blobs": agent_config,
                         }),
                     )
+
+
+class TestCustomContainer:
+    @patch("cephadm.serve.CephadmServe._run_cephadm")
+    def test_deploy_custom_container(
+        self, _run_cephadm, cephadm_module: CephadmOrchestrator
+    ):
+        _run_cephadm.side_effect = async_side_effect(('{}', '', 0))
+
+        spec = CustomContainerSpec(
+            service_id='tsettinu',
+            image='quay.io/foobar/barbaz:latest',
+            entrypoint='/usr/local/bin/blat.sh',
+            ports=[9090],
+        )
+
+        with with_host(cephadm_module, 'test'):
+            with with_service(cephadm_module, spec):
+                _run_cephadm.assert_called_with(
+                    'test',
+                    "container.tsettinu.test",
+                    ['_orch', 'deploy'],
+                    [],
+                    stdin=json.dumps(
+                        {
+                            "fsid": "fsid",
+                            "name": 'container.tsettinu.test',
+                            "image": 'quay.io/foobar/barbaz:latest',
+                            "deploy_arguments": [],
+                            "params": {
+                                'tcp_ports': [9090],
+                            },
+                            "meta": {
+                                'service_name': 'container.tsettinu',
+                                'ports': [],
+                                'ip': None,
+                                'deployed_by': [],
+                                'rank': None,
+                                'rank_generation': None,
+                                'extra_container_args': None,
+                                'extra_entrypoint_args': None,
+                            },
+                            "config_blobs": {
+                                "image": "quay.io/foobar/barbaz:latest",
+                                "entrypoint": "/usr/local/bin/blat.sh",
+                                "args": [],
+                                "envs": [],
+                                "volume_mounts": {},
+                                "privileged": False,
+                                "ports": [9090],
+                                "dirs": [],
+                                "files": {},
+                            },
+                        }
+                    ),
+                )