]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: ensure RBD integration tests exercise all features 3535/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 28 Jan 2015 15:32:20 +0000 (10:32 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 28 Jan 2015 15:34:48 +0000 (10:34 -0500)
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 <dillaman@redhat.com>
src/test/pybind/test_rbd.py
src/test/run-rbd-tests

index c713ff3c27aa90f510693d9527e35b49230b0962..337c874432f9c9e7c39e612898469e63c5643e57 100644 (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)
index 7cf9159b3eed19fb2abfd6086c6bb60573bb792a..6a6e1f21939ba8e05c79ec6900a54dc22f83902d 100755 (executable)
@@ -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