Commit 62fb49ce authored by Samuel GAIST's avatar Samuel GAIST

[test][bcp] Do not use qsize as it is not implemented on macOS

Store the returned value and check that we have what we
wanted.

https://docs.python.org/3/library/multiprocessing.html?highlight=qsize
parent d0fc75da
Pipeline #27264 passed with stage
in 17 minutes and 37 seconds
......@@ -33,6 +33,7 @@ import json
import unittest
import multiprocessing
import queue
import zmq
......@@ -193,16 +194,22 @@ class TestBroker(unittest.TestCase):
worker.join()
max_rounds = 5
while max_rounds > 0 and self.queue.qsize() < 2:
queue_messages = []
while max_rounds > 0 and len(queue_messages) < 2:
max_rounds -= 1
broker_p.join(5) # give time to have heartbeat sent and gone detected
try:
message = self.queue.get(block=True, timeout=5)
except queue.Empty:
pass
else:
queue_messages.append(message)
broker_p.terminate()
broker_p.join()
self.assertEqual(self.queue.qsize(), 2)
self.assertEqual(self.queue.get(), "ready")
self.assertEqual(self.queue.get(), "gone")
self.assertEqual(len(queue_messages), 2)
self.assertEqual(queue_messages[0], "ready")
self.assertEqual(queue_messages[1], "gone")
class TestBCP(ExcecutionTestCase):
......
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