]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/cephadm/tests/test_spec.py
import quincy beta 17.1.0
[ceph.git] / ceph / src / pybind / mgr / cephadm / tests / test_spec.py
index 23fcf9c2367a0c925e1ffccb6cacca9bd776003e..c89d3b6c1ca6443f60737a26ecaae8e53e1293b9 100644 (file)
@@ -6,11 +6,8 @@ import json
 
 import pytest
 
-import yaml
-
 from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec, RGWSpec, \
-    IscsiServiceSpec, AlertManagerSpec, HostPlacementSpec, CustomContainerSpec
-
+    IscsiServiceSpec, HostPlacementSpec, CustomContainerSpec
 from orchestrator import DaemonDescription, OrchestratorError
 
 
@@ -580,18 +577,6 @@ def test_dd_octopus(dd_json):
         True
     ),
 
-    (
-        # daemon_id only contains hostname
-        ServiceSpec(
-            service_type='cephadm-exporter',
-        ),
-        DaemonDescription(
-            daemon_type='cephadm-exporter',
-            daemon_id="testhost",
-            hostname="testhost",
-        ),
-        True
-    ),
 ])
 def test_daemon_description_service_name(spec: ServiceSpec,
                                          dd: DaemonDescription,
@@ -601,92 +586,3 @@ def test_daemon_description_service_name(spec: ServiceSpec,
     else:
         with pytest.raises(OrchestratorError):
             dd.service_name()
-
-
-def test_alertmanager_spec_1():
-    spec = AlertManagerSpec()
-    assert spec.service_type == 'alertmanager'
-    assert isinstance(spec.user_data, dict)
-    assert len(spec.user_data.keys()) == 0
-
-
-def test_alertmanager_spec_2():
-    spec = AlertManagerSpec(user_data={'default_webhook_urls': ['foo']})
-    assert isinstance(spec.user_data, dict)
-    assert 'default_webhook_urls' in spec.user_data.keys()
-
-
-def test_custom_container_spec():
-    spec = CustomContainerSpec(service_id='hello-world',
-                               image='docker.io/library/hello-world:latest',
-                               entrypoint='/usr/bin/bash',
-                               uid=1000,
-                               gid=2000,
-                               volume_mounts={'foo': '/foo'},
-                               args=['--foo'],
-                               envs=['FOO=0815'],
-                               bind_mounts=[
-                                   [
-                                       'type=bind',
-                                       'source=lib/modules',
-                                       'destination=/lib/modules',
-                                       'ro=true'
-                                   ]
-                               ],
-                               ports=[8080, 8443],
-                               dirs=['foo', 'bar'],
-                               files={
-                                   'foo.conf': 'foo\nbar',
-                                   'bar.conf': ['foo', 'bar']
-                               })
-    assert spec.service_type == 'container'
-    assert spec.entrypoint == '/usr/bin/bash'
-    assert spec.uid == 1000
-    assert spec.gid == 2000
-    assert spec.volume_mounts == {'foo': '/foo'}
-    assert spec.args == ['--foo']
-    assert spec.envs == ['FOO=0815']
-    assert spec.bind_mounts == [
-        [
-            'type=bind',
-            'source=lib/modules',
-            'destination=/lib/modules',
-            'ro=true'
-        ]
-    ]
-    assert spec.ports == [8080, 8443]
-    assert spec.dirs == ['foo', 'bar']
-    assert spec.files == {
-        'foo.conf': 'foo\nbar',
-        'bar.conf': ['foo', 'bar']
-    }
-
-
-def test_custom_container_spec_config_json():
-    spec = CustomContainerSpec(service_id='foo', image='foo', dirs=None)
-    config_json = spec.config_json()
-    for key in ['entrypoint', 'uid', 'gid', 'bind_mounts', 'dirs']:
-        assert key not in config_json
-
-
-def test_ingress_spec():
-    yaml_str = """service_type: ingress
-service_id: rgw.foo
-placement:
-  hosts:
-    - host1
-    - host2
-    - host3
-spec:
-  virtual_ip: 192.168.20.1/24
-  backend_service: rgw.foo
-  frontend_port: 8080
-  monitor_port: 8081
-"""
-    yaml_file = yaml.safe_load(yaml_str)
-    spec = ServiceSpec.from_json(yaml_file)
-    assert spec.service_type == "ingress"
-    assert spec.service_id == "rgw.foo"
-    assert spec.virtual_ip == "192.168.20.1/24"
-    assert spec.frontend_port == 8080
-    assert spec.monitor_port == 8081