From: Jason Dillaman Date: Wed, 28 Jan 2015 15:32:20 +0000 (-0500) Subject: tests: ensure RBD integration tests exercise all features X-Git-Tag: v0.93~166^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F3535%2Fhead;p=ceph.git tests: ensure RBD integration tests exercise all features The RBD_FEATURES environment variables was not being exported to the Python and C++ integration tests. This resulted in the same test cases being run multiple times instead of testing different RBD features. Signed-off-by: Jason Dillaman --- diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index c713ff3c27aa..337c874432f9 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -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) diff --git a/src/test/run-rbd-tests b/src/test/run-rbd-tests index 7cf9159b3eed..6a6e1f21939b 100755 --- a/src/test/run-rbd-tests +++ b/src/test/run-rbd-tests @@ -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