Skip to content

Commit

Permalink
mgr/ssh: add make check integration
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
  • Loading branch information
sebastian-philipp committed Nov 14, 2019
1 parent 86c4e2a commit c7bb0ec
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
7 changes: 6 additions & 1 deletion 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
Empty file.
15 changes: 15 additions & 0 deletions 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'

2 changes: 1 addition & 1 deletion src/pybind/mgr/tox.ini
Expand Up @@ -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/}
commands = pytest --cov --cov-append --cov-report=term --doctest-modules {posargs:mgr_util.py tests/ ssh/}

0 comments on commit c7bb0ec

Please sign in to comment.