Commit 416bae7d authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[1927] Use barrier instead of sleep

It should be more reliable to ensure all messages arrived.
parent c8b7d82c
......@@ -235,11 +235,11 @@ class MsgqRunTest(unittest.TestCase):
self.assertTrue(lname in lnames)
lnames.remove(lname)
# Wait a short time, so messages sent where they don't belong get some
# time to arrive. They could still be late, so the test could still
# pass on a slow machine, but an unreliable test is better than none
# at all. Any idea how to do it in a better way?
time.sleep(0.1)
# The barrier makes the msgq process everything we sent. As the
# processing is single-threaded in it, any stray message would have
# arrived before the barrier ends.
self.__barrier(conn_b)
self.__barrier([conn_a])
for c in conn_b:
self.assertEqual((None, None), c.group_recvmsg())
self.assertEqual((None, None), conn_a.group_recvmsg())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment