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

SW-610: fixed messagebus test which failed if ran in parallel in multiple...

SW-610: fixed messagebus test which failed if ran in parallel in multiple builds-with-tests. The problem was a too largs messagebody filling the broker queue. Reduced the bodies size to a more real life value.
parent 59249b78
No related branches found
No related tags found
No related merge requests found
......@@ -82,8 +82,8 @@ class FromBus(object):
try:
logger.debug("[FromBus] Connecting to broker: %s", self.broker)
if 'reconnect' in self.broker_options:
# Ignoring duplicate reconnect option in connection init. Is taken care of by proton.
self.broker_options.pop('reconnect')
logger.info('[FromBus] Ignoring duplicate reconnect option in connection init')
self.connection = proton.utils.BlockingConnection(self.broker, **self.broker_options)
logger.debug("[FromBus] Connected to broker: %s", self.broker)
except proton.ConnectionException as ex:
......
......@@ -394,13 +394,8 @@ class SendReceiveMessage(unittest.TestCase):
self.test_queue.open()
self.addCleanup(self.test_queue.close)
self.frombus = FromBus(self.test_queue.address)
self.tobus = ToBus(self.test_queue.address)
# if there are any dangling messages in the self.test_queue.address, they hold state between the individual tests
# make sure the queue is empty by receiving any dangling messages
with self.frombus:
self.frombus.drain()
self.frombus = self.test_queue.create_frombus()
self.tobus = self.test_queue.create_tobus()
def _test_sendrecv(self, send_msg):
"""
......@@ -473,7 +468,7 @@ class SendReceiveMessage(unittest.TestCase):
"""
Test send/receive of an RequestMessage, containing a large string
"""
content = 1000000*'abcdefghijklmnopqrstuvwxyz' # 1 million 24char string
content = 100000*'abcdefghijklmnopqrstuvwxyz' #large enough string, but not too big to overload the broker buffers
self._test_sendrecv(RequestMessage(content, reply_to=self.test_queue.address))
def test_sendrecv_request_message_with_nested_dicts_and_lists_with_special_types(self):
......@@ -488,7 +483,7 @@ class SendReceiveMessage(unittest.TestCase):
{'a': 'b',
'c': { 'timestamp': round_to_millisecond_precision(datetime.utcnow())}}],
'bar': [],
'large_string': 1000000*'abcdefghijklmnopqrstuvwxyz' # 1 million 24char string
'large_string': 100000*'abcdefghijklmnopqrstuvwxyz' #large enough string, but not too big to overload the broker buffers
}
self._test_sendrecv(RequestMessage(content, reply_to=self.test_queue.address))
......@@ -502,5 +497,5 @@ class SendReceiveMessage(unittest.TestCase):
self.assertEqual(content, convertStringDigitKeysToInt(recv_msg.body))
if __name__ == '__main__':
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
unittest.main()
logging.basicConfig(format='%(asctime)s %(process)d %(levelname)s %(message)s', level=logging.INFO)
unittest.main(defaultTest='SendReceiveMessage')
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