Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
- Loading branch information
1 parent
b55f6d8
commit de5c700
Showing
6 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if(WITH_TESTS) | ||
include(AddCephTest) | ||
add_tox_test(mgr-ssh) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
from .module import SSHOrchestrator | ||
from __future__ import absolute_import | ||
|
||
import os | ||
|
||
|
||
if 'UNITTEST' not in os.environ: | ||
from .module import SSHOrchestrator | ||
else: | ||
import sys | ||
|
||
try: | ||
from unittest.mock import Mock, MagicMock | ||
except ImportError: | ||
from mock import Mock, MagicMock | ||
|
||
class M(object): | ||
def __init__(self, *args): | ||
super(M, self).__init__() | ||
self._ceph_get_version = Mock() | ||
self._ceph_get = MagicMock() | ||
self._ceph_get_module_option = MagicMock() | ||
self._ceph_log = MagicMock() | ||
self._ceph_get_option = MagicMock() | ||
self._ceph_get_store = lambda _: '' | ||
self._ceph_get_store_prefix = lambda _: {} | ||
|
||
|
||
cm = Mock() | ||
cm.BaseMgrModule = M | ||
cm.BaseMgrStandbyModule = M | ||
sys.modules['ceph_module'] = cm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
tox==2.9.1 | ||
remoto | ||
pytest | ||
-e ../../../python-common |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from orchestrator import ServiceDescription | ||
from ..module import SSHOrchestrator | ||
|
||
|
||
def test_get_unique_name(): | ||
o = SSHOrchestrator() | ||
existing = [ | ||
ServiceDescription(service_instance='mon.a') | ||
] | ||
new_mon = o.get_unique_name(existing, 'mon') | ||
assert new_mon.startswith('mon.') | ||
assert new_mon != 'mon.a' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[tox] | ||
envlist = py27,py3 | ||
skipsdist = true | ||
toxworkdir = {env:CEPH_BUILD_DIR}/ssh | ||
minversion = 2.5 | ||
|
||
[testenv] | ||
deps = | ||
-rrequirements.txt | ||
setenv= | ||
UNITTEST = true | ||
py27: PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.2 | ||
py3: PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.3 | ||
|
||
commands= | ||
{envbindir}/py.test tests/ |