Add helper for creating rbd-mirror key
tox: Remove cleanup of Python object files as this breaks in the upstream gate. tox: While at it migrate from os-testr to stestr. Change-Id: I1bad5311ed034188a78dc67b493c22bff7ce4f7d
This commit is contained in:
3
.stestr.conf
Normal file
3
.stestr.conf
Normal file
@ -0,0 +1,3 @@
|
||||
[DEFAULT]
|
||||
test_path=./unit_tests
|
||||
top_dir=./
|
@ -1,8 +0,0 @@
|
||||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||
${PYTHON:-python} -m subunit.run discover -t ./ ./unit_tests $LISTOPT $IDOPTION
|
||||
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
@ -1132,6 +1132,15 @@ osd_upgrade_caps = collections.OrderedDict([
|
||||
])
|
||||
])
|
||||
|
||||
rbd_mirror_caps = collections.OrderedDict([
|
||||
('mon', ['profile rbd']),
|
||||
('osd', ['profile rbd']),
|
||||
])
|
||||
|
||||
|
||||
def get_rbd_mirror_key(name):
|
||||
return get_named_key(name=name, caps=rbd_mirror_caps)
|
||||
|
||||
|
||||
def create_named_keyring(entity, name, caps=None):
|
||||
caps = caps or _default_caps
|
||||
|
@ -5,6 +5,6 @@ coverage>=3.6
|
||||
nose
|
||||
mock>=1.2
|
||||
flake8>=2.2.4,<=2.4.1
|
||||
os-testr>=0.4.1
|
||||
stestr
|
||||
requests==2.6.0
|
||||
netifaces
|
||||
|
9
tox.ini
9
tox.ini
@ -7,14 +7,9 @@ skip_missing_interpreters = True
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
install_command =
|
||||
pip install {opts} {packages}
|
||||
commands = find . -type f -name "*.py[c|o]" -delete
|
||||
find . -type d -name "__pycache__" -delete
|
||||
rm -f .testrepository/times.dbm
|
||||
ostestr {posargs}
|
||||
commands =
|
||||
stestr run {posargs}
|
||||
sitepackages = False
|
||||
whitelist_externals =
|
||||
find
|
||||
rm
|
||||
|
||||
[testenv:py27]
|
||||
# ceph charms are Python3-only, but py27 unit test target
|
||||
|
@ -12,6 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import collections
|
||||
import unittest
|
||||
|
||||
from mock import (
|
||||
@ -804,6 +805,17 @@ class CephTestCase(unittest.TestCase):
|
||||
self.assertEqual(utils._partition_name('/dev/mmcblk0'),
|
||||
'/dev/mmcblk0p1')
|
||||
|
||||
@patch.object(utils, 'get_named_key')
|
||||
def test_get_rbd_mirror_key(self, _get_named_key):
|
||||
utils.get_rbd_mirror_key('someid')
|
||||
_get_named_key.assert_called_once_with(
|
||||
name='someid',
|
||||
caps=collections.OrderedDict([
|
||||
('mon', ['profile rbd']),
|
||||
('osd', ['profile rbd']),
|
||||
])
|
||||
)
|
||||
|
||||
|
||||
class CephVolumeSizeCalculatorTestCase(unittest.TestCase):
|
||||
|
||||
|
Reference in New Issue
Block a user