]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ssh: add make check integration 31523/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 11 Nov 2019 10:51:14 +0000 (11:51 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 14 Nov 2019 15:22:17 +0000 (16:22 +0100)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/ssh/__init__.py
src/pybind/mgr/ssh/tests/__init__.py [new file with mode: 0644]
src/pybind/mgr/ssh/tests/test_ssh.py [new file with mode: 0644]
src/pybind/mgr/tox.ini

index 3f41e016e73f40dc90a03b9f0c83ed0ce0e121b4..cb88e7fe1d35f59b6242d0a3d6243e9f2cc87be5 100644 (file)
@@ -1 +1,6 @@
-from .module import SSHOrchestrator
+import os
+
+if 'UNITTEST' in os.environ:
+    import tests
+
+from .module import SSHOrchestrator
\ No newline at end of file
diff --git a/src/pybind/mgr/ssh/tests/__init__.py b/src/pybind/mgr/ssh/tests/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/pybind/mgr/ssh/tests/test_ssh.py b/src/pybind/mgr/ssh/tests/test_ssh.py
new file mode 100644 (file)
index 0000000..639f08c
--- /dev/null
@@ -0,0 +1,15 @@
+from orchestrator import ServiceDescription
+from ..module import SSHOrchestrator
+from tests import mock
+
+
+@mock.patch("ssh.module.SSHOrchestrator.get_ceph_option", lambda _,key: __file__)
+def test_get_unique_name():
+    o = SSHOrchestrator('module_name', 0, 0)
+    existing = [
+        ServiceDescription(service_instance='mon.a')
+    ]
+    new_mon = o.get_unique_name(existing, 'mon')
+    assert new_mon.startswith('mon.')
+    assert new_mon != 'mon.a'
+
index 4205dce13459f71d725392416de6d3d0aba67d2a..7a516f8cae28022eb1b07a51131c3687b855339a 100644 (file)
@@ -5,4 +5,4 @@ skipsdist = true
 [testenv]
 setenv = UNITTEST = true
 deps = -rrequirements.txt
-commands = pytest --cov --cov-append --cov-report=term --doctest-modules {posargs:mgr_util.py tests/}
\ No newline at end of file
+commands = pytest --cov --cov-append --cov-report=term --doctest-modules {posargs:mgr_util.py tests/ ssh/}
\ No newline at end of file