Skip to content

Commit

Permalink
more verbose logging
Browse files Browse the repository at this point in the history
  • Loading branch information
kgiusti committed Sep 6, 2024
1 parent 05c6089 commit cec6913
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
31 changes: 18 additions & 13 deletions tests/system_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1554,30 +1554,34 @@ def get_queue_stats(self):
return self.queue_stats % (self.num_queue_puts, self.num_queue_gets)

def _main(self):
self._container.timeout = 0.5
self._container.start()
self._logger.log("AsyncTestReceiver Starting reactor")
while self._container.process():
if self._stop_thread:
if self._conn:
self._conn.close()
self._conn = None
self._ready.set()
self._logger.log("AsyncTestReceiver reactor thread done")
try:
self._container.timeout = 0.5
self._container.start()
self._logger.log("AsyncTestReceiver Starting reactor")
while self._container.process():
if self._stop_thread:
if self._conn:
self._conn.close()
self._conn = None
self._ready.set()
self._logger.log(f"AsyncTestReceiver reactor thread done ({self._error})")
except Exception as exc:
print(f"AsyncTestReceiver failed with unexpected exception={exc}",
flush=True)

def on_transport_error(self, event):
self._logger.log("AsyncTestReceiver on_transport_error=%s" % event.transport.condition.description)
self._error = f"Connection Error: {event.transport.condition.description}"
self._logger.log(f"AsyncTestReceiver on_transport_error={self._error}")
self._stop_thread = True

def on_connection_error(self, event):
self._logger.log("AsyncTestReceiver on_connection_error=%s" % event.connection.remote_condition.description)
self._error = f"Connection Error: {event.connection.remote_condition.description}"
self._logger.log(f"AsyncTestReceiver on_connection_error={self._error}")
self._stop_thread = True

def on_link_error(self, event):
self._logger.log("AsyncTestReceiver on_link_error=%s" % event.link.remote_condition.description)
self._error = f"Link Error: {event.link.remote_condition.description}"
self._logger.log(f"AsyncTestReceiver on_link_error={self._error}")
self._stop_thread = True

def stop(self, timeout=TIMEOUT):
Expand All @@ -1589,6 +1593,7 @@ def stop(self, timeout=TIMEOUT):
del self._conn
del self._container
if self._error is not None:
self._logger.log(f"Stopped with error: {self._error}")
raise AsyncTestReceiver.TestReceiverException(self._error)

def on_start(self, event):
Expand Down
18 changes: 10 additions & 8 deletions tests/system_tests_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,10 +1140,11 @@ def test_ssl_client_profile_update(self):
'allowed_mechs': "EXTERNAL",
'ssl_domain': ssl_domain}
with self.assertRaises(AsyncTestReceiver.TestReceiverException) as exc:
AsyncTestReceiver(f"amqps://localhost:{self.listener1_port}",
source="test/addr",
container_id="FooRx2",
conn_args=conn_args)
rx = AsyncTestReceiver(f"amqps://localhost:{self.listener1_port}",
source="test/addr",
container_id="FooRx2",
conn_args=conn_args)
rx.stop()
self.assertIn("certificate verify failed", str(exc.exception), f"{exc.exception}")

ssl_domain = SSLDomain(SSLDomain.MODE_CLIENT)
Expand All @@ -1154,10 +1155,11 @@ def test_ssl_client_profile_update(self):
'allowed_mechs': "EXTERNAL",
'ssl_domain': ssl_domain}
with self.assertRaises(AsyncTestReceiver.TestReceiverException) as exc:
AsyncTestReceiver(f"amqps://localhost:{self.listener2_port}",
source="test/addr",
container_id="FooRx3",
conn_args=conn_args)
rx = AsyncTestReceiver(f"amqps://localhost:{self.listener2_port}",
source="test/addr",
container_id="FooRx3",
conn_args=conn_args)
rx.stop()
self.assertIn("certificate verify failed", str(exc.exception), f"{exc.exception}")

#
Expand Down

0 comments on commit cec6913

Please sign in to comment.