From 23683c26f87931b1fd0d3103a23e9c0b11bb95a9 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Tue, 13 Oct 2009 18:30:40 +0200 Subject: [PATCH] Test LockSet.acquire return value for timeout Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- test/ganeti.locking_unittest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/ganeti.locking_unittest.py b/test/ganeti.locking_unittest.py index f3630b791..094de0298 100755 --- a/test/ganeti.locking_unittest.py +++ b/test/ganeti.locking_unittest.py @@ -1002,10 +1002,12 @@ class TestLockSet(_ThreadedTestCase): def _AcquireOne(): # Try to get the same lock again with a timeout (should never succeed) - if self.ls.acquire(wanted, timeout=0.1, shared=0): + acquired = self.ls.acquire(wanted, timeout=0.1, shared=0) + if acquired: self.done.put("acquired") self.ls.release() else: + self.assert_(acquired is None) self.assert_(not self.ls._list_owned()) self.assert_(not self.ls._is_owned()) self.done.put("not acquired") -- GitLab