summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-06 14:46:50 +0000
committerGerrit Code Review <review@openstack.org>2013-02-06 14:46:50 +0000
commit51bee3c7b53acca108f191a152a3783600d0f51a (patch)
tree47ba93156e93f51fd9ee587a0bcd268acf700136 /tests
parente7c973ed8d708cf950acb25612b646260bccaca0 (diff)
parent51efba78bdcee821937c28c1973ec80e8c2d59ae (diff)
Merge "Emit a warning if RPC calls made with lock."
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/rpc/test_proxy.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unit/rpc/test_proxy.py b/tests/unit/rpc/test_proxy.py
index 64eb008..436bcab 100644
--- a/tests/unit/rpc/test_proxy.py
+++ b/tests/unit/rpc/test_proxy.py
@@ -21,6 +21,7 @@ Unit Tests for rpc.proxy
import copy
from openstack.common import context
+from openstack.common import lockutils
from openstack.common.fixture import moxstubout
from openstack.common import rpc
from openstack.common.rpc import proxy
@@ -45,6 +46,7 @@ class RpcProxyTestCase(utils.BaseTestCase):
self.fake_kwargs = None
def _fake_rpc_method(*args, **kwargs):
+ rpc._check_for_lock()
self.fake_args = args
self.fake_kwargs = kwargs
if has_retval:
@@ -101,6 +103,17 @@ class RpcProxyTestCase(utils.BaseTestCase):
def test_multicall(self):
self._test_rpc_method('multicall', has_timeout=True, has_retval=True)
+ def test_multicall_with_lock_held(self):
+ self.config(debug=True)
+ self.assertFalse(rpc._check_for_lock())
+
+ @lockutils.synchronized('detecting', 'test-')
+ def f():
+ self.assertTrue(rpc._check_for_lock())
+ f()
+
+ self.assertFalse(rpc._check_for_lock())
+
def test_cast(self):
self._test_rpc_method('cast')