From: Sebastian Wagner Date: Mon, 11 Nov 2019 10:51:14 +0000 (+0100) Subject: mgr/ssh: add make check integration X-Git-Tag: v15.1.0~890^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F31523%2Fhead;p=ceph.git mgr/ssh: add make check integration Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/ssh/__init__.py b/src/pybind/mgr/ssh/__init__.py index 3f41e016e73f..cb88e7fe1d35 100644 --- a/src/pybind/mgr/ssh/__init__.py +++ b/src/pybind/mgr/ssh/__init__.py @@ -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 index 000000000000..e69de29bb2d1 diff --git a/src/pybind/mgr/ssh/tests/test_ssh.py b/src/pybind/mgr/ssh/tests/test_ssh.py new file mode 100644 index 000000000000..639f08c92434 --- /dev/null +++ b/src/pybind/mgr/ssh/tests/test_ssh.py @@ -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' + diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 4205dce13459..7a516f8cae28 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -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