Commit a9c3c4ad authored by Jorrit Schaap's avatar Jorrit Schaap

TMSS-163: skip reconnect test if rabbitmq admin server is not available

parent 00c5b706
......@@ -886,8 +886,17 @@ class ReconnectOnConnectionLossTests(unittest.TestCase):
self.tmp_exchange.close()
self.assertFalse(exchange_exists(tmp_exchange_address))
def _can_connect_to_rabbitmq_admin_site(self, hostname: str):
try:
url = 'http://%s:15672/api' % (hostname,)
return requests.get(url, auth=(DEFAULT_USER, DEFAULT_PASSWORD)).status_code in [200, 202]
except requests.ConnectionError:
return False
def _close_connection_of_bus_on_broker(self, bus: _AbstractBus):
if not self._can_connect_to_rabbitmq_admin_site(bus.broker):
raise unittest.SkipTest("Cannot connect tot RabbitMQ admin server to close connection %s" % (bus.connection_name))
# use the http REST API using request to forcefully close the connection on the broker-side
url = "http://%s:15672/api/connections/%s" % (bus.broker, bus.connection_name)
......
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