Merge pull request #3535 from ceph/wip-librbd-tests

tests: ensure RBD integration tests exercise all features

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
Josh Durgin 2015-01-29 08:40:26 -08:00
commit dd3ad6b9fe
2 changed files with 19 additions and 2 deletions

View File

@ -84,6 +84,17 @@ def require_features(required_features):
return functools.wraps(fn)(_require_features)
return wrapper
def blacklist_features(blacklisted_features):
def wrapper(fn):
def _blacklist_features(*args, **kwargs):
global features
for feature in blacklisted_features:
if features is not None and feature & features == feature:
raise SkipTest
return fn(*args, **kwargs)
return functools.wraps(fn)(_blacklist_features)
return wrapper
def test_version():
RBD().version()
@ -406,11 +417,17 @@ class TestImage(object):
assert_raises(ImageNotFound, self.image.unprotect_snap, 'snap1')
assert_raises(ImageNotFound, self.image.is_protected_snap, 'snap1')
@require_features([RBD_FEATURE_EXCLUSIVE_LOCK])
def test_remove_with_exclusive_lock(self):
assert_raises(ImageBusy, remove_image)
@blacklist_features([RBD_FEATURE_EXCLUSIVE_LOCK])
def test_remove_with_snap(self):
self.image.create_snap('snap1')
assert_raises(ImageHasSnapshots, remove_image)
self.image.remove_snap('snap1')
@blacklist_features([RBD_FEATURE_EXCLUSIVE_LOCK])
def test_remove_with_watcher(self):
data = rand_data(256)
self.image.write(data, 0)

View File

@ -32,12 +32,12 @@ ceph_test_cls_rbd
run_api_tests
run_cli_tests
RBD_CREATE_ARGS="--format 2"
export RBD_CREATE_ARGS="--format 2"
run_cli_tests
for i in 0 1 5
do
RBD_FEATURES=$i
export RBD_FEATURES=$i
run_api_tests
done