diff --git a/LCS/Messaging/python/messaging/messagebus.py b/LCS/Messaging/python/messaging/messagebus.py index 1d98ad7ebe40b3dbefc21b210a4685131ceb9bb8..9e63a6bc7fae68fd4e4dc710e3527762ddfbdc6e 100644 --- a/LCS/Messaging/python/messaging/messagebus.py +++ b/LCS/Messaging/python/messaging/messagebus.py @@ -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: diff --git a/LCS/Messaging/python/messaging/test/t_messagebus.py b/LCS/Messaging/python/messaging/test/t_messagebus.py index aaae9a5dfc1ca1255c44ed7b4540635757e60a18..9fd36ba7db3e143415fe0ecee7256b53eaf31fc3 100644 --- a/LCS/Messaging/python/messaging/test/t_messagebus.py +++ b/LCS/Messaging/python/messaging/test/t_messagebus.py @@ -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')