Skip to content
Snippets Groups Projects
Commit adfb7ea6 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #8899: Disable auto-connect for all tests to allow tests for invalid broker addresses.

parent dbb2776c
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,9 @@ from lofar.messaging.exceptions import MessageBusError, InvalidMessage
TIMEOUT = 1.0
# Disable auto reconnect to test behaviour w.r.t. invalid addresses
DEFAULT_BROKER_OPTIONS['reconnect'] = False
# ======== FromBus unit tests ======== #
......@@ -171,18 +174,11 @@ class ToBusInitFailed(unittest.TestCase):
"""
Connecting to broker on wrong port must raise MessageBusError
"""
# Cache and disable auto reconnect
old_reconnect = DEFAULT_BROKER_OPTIONS.get('reconnect', False)
DEFAULT_BROKER_OPTIONS['reconnect'] = False
regexp = re.escape(self.error) + '.*' + 'Connection refused'
with self.assertRaisesRegexp(MessageBusError, regexp):
with ToBus(QUEUE, broker="localhost:4"):
pass
# Restore auto reconnect
DEFAULT_BROKER_OPTIONS['reconnect'] = old_reconnect
class ToBusSendMessage(unittest.TestCase):
"""
......
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