From b81402295aa4f9404b494d1f7715f14791242b5d Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Thu, 1 Oct 2009 14:09:35 +0100
Subject: [PATCH] testNotification: add more checking about order

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 test/ganeti.locking_unittest.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/ganeti.locking_unittest.py b/test/ganeti.locking_unittest.py
index b279dddb1..2300517db 100755
--- a/test/ganeti.locking_unittest.py
+++ b/test/ganeti.locking_unittest.py
@@ -95,13 +95,20 @@ class _ConditionTestCase(_ThreadedTestCase):
 
   def _testNotification(self):
     def _NotifyAll():
+      self.done.put("NE")
       self.cond.acquire()
+      self.done.put("NA")
       self.cond.notifyAll()
+      self.done.put("NN")
       self.cond.release()
 
     self.cond.acquire()
     self._addThread(target=_NotifyAll)
+    self.assertEqual(self.done.get(True, 1), "NE")
+    self.assertRaises(Queue.Empty, self.done.get_nowait)
     self.cond.wait()
+    self.assertEqual(self.done.get(True, 1), "NA")
+    self.assertEqual(self.done.get(True, 1), "NN")
     self.assert_(self.cond._is_owned())
     self.cond.release()
     self.assert_(not self.cond._is_owned())
-- 
GitLab