Skip to content
Snippets Groups Projects
Commit 8eef2fd1 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Merge branch 'SW-954' into 'master'

SW-954: fixed blinking test

Closes SW-954

See merge request !360
parents 2692f665 975fed6e
No related branches found
No related tags found
1 merge request!360SW-954: fixed blinking test
......@@ -382,10 +382,11 @@ class RPCClient():
tmp_reply_queue.address)
answer = reply_receiver.receive(wait_time)
elapsed = (datetime.utcnow() - start_time).total_seconds()
if answer is None:
if answer is None or elapsed > self._timeout:
raise RPCTimeoutException("rpc call to service.method=%s via exchange=%s timed out after %.1fsec" % (
service_method, exchange, self._timeout))
service_method, exchange, elapsed))
if not isinstance(answer, ReplyMessage):
raise ValueError("rpc call to service.method=%s via exchange=%s received an unexpected non-ReplyMessage of type %s" % (
......
......@@ -110,9 +110,19 @@ class TestRPC(unittest.TestCase):
self._do_call_slow_method = False
# notify externals that we encountered this part of the handling code
event1.set()
# calling the my_public_slow_method will cause an RPCTimeout,
# resulting in this lofar_msg not being acked
# resulting in this lofar_msg being received again, and handled again, by else below.
logger.info("handling msg %s in the slow path... calling my_public_slow_method", lofar_msg.id)
rpc_client.execute("my_public_slow_method")
else:
# give the rpc some slack (sometimes needed on slow systems)
rpc_client._timeout = 10
logger.info("handling msg %s in the fast path... calling my_public_method1", lofar_msg.id)
rpc_client.execute("my_public_method1")
logger.info("handled msg %s in the fast path. called my_public_method1", lofar_msg.id)
# notify externals that we encountered this part of the handling code
event2.set()
......@@ -139,7 +149,7 @@ class TestRPC(unittest.TestCase):
event1.wait(5)
self.assertTrue(event1.is_set())
event2.wait(5)
event2.wait(15)
self.assertTrue(event2.is_set())
if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment