Skip to content

Commit

Permalink
Issue skupperproject#1683: Enable verbose logging in AsyncTestReceiver
Browse files Browse the repository at this point in the history
This does not fix the issue but will give more detail should the error
happen again.
  • Loading branch information
kgiusti committed Nov 26, 2024
1 parent b478fb5 commit 6969b68
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
11 changes: 9 additions & 2 deletions tests/system_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1532,14 +1532,17 @@ def __init__(self, address, source, conn_args=None, container_id=None,
self._thread.start()
self.num_queue_puts = 0
self.num_queue_gets = 0
self.queue_stats = "self.num_queue_puts=%d, self.num_queue_gets=%d"
self._error = None
if wait:
ready = self._ready.wait(timeout=TIMEOUT)
if ready is False:
self._logger.log("AsyncTestReceiver connection attempt timed out")
raise AsyncTestReceiver.TestReceiverException("Timed out waiting for receiver start")
elif self._error is not None:
self._logger.log("AsyncTestReceiver connection attempt failed, error=%s" % self._error)
raise AsyncTestReceiver.TestReceiverException(self._error)
self.queue_stats = "self.num_queue_puts=%d, self.num_queue_gets=%d"
self._logger.log("AsyncTestReceiver thread running")

def get_queue_stats(self):
return self.queue_stats % (self.num_queue_puts, self.num_queue_gets)
Expand All @@ -1558,7 +1561,7 @@ def _main(self):

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._error = f"Transport Error: {event.transport.condition.description}"
self._stop_thread = True

def on_connection_error(self, event):
Expand All @@ -1572,15 +1575,19 @@ def on_link_error(self, event):
self._stop_thread = True

def stop(self, timeout=TIMEOUT):
self._logger.log("AsyncTestReceiver stopping")
self._stop_thread = True
self._container.wakeup()
self._thread.join(timeout=TIMEOUT)
if self._thread.is_alive():
self._logger.log("AsyncTestReceiver did not stop!")
raise AsyncTestReceiver.TestReceiverException("AsyncTestReceiver did not exit")
del self._conn
del self._container
if self._error is not None:
self._logger.log("AsyncTestReceiver failed with error=%s" % self._error)
raise AsyncTestReceiver.TestReceiverException(self._error)
self._logger.log("AsyncTestReceiver stopped!")

def on_start(self, event):
kwargs = {'url': self.address}
Expand Down
12 changes: 8 additions & 4 deletions tests/system_tests_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,8 @@ def test_ssl_client_profile_update(self):
test_rx = AsyncTestReceiver(f"amqps://localhost:{self.listener1_port}",
source="test/addr",
container_id="FooRx",
conn_args=conn_args)
conn_args=conn_args,
print_to_console=True)

ssl_domain = SSLDomain(SSLDomain.MODE_CLIENT)
ssl_domain.set_trusted_ca_db(CA2_CERT)
Expand Down Expand Up @@ -1154,7 +1155,8 @@ def test_ssl_client_profile_update(self):
atr = AsyncTestReceiver(f"amqps://localhost:{self.listener1_port}",
source="test/addr",
container_id="FooRx2",
conn_args=conn_args)
conn_args=conn_args,
print_to_console=True)
atr.stop()
self.assertIn("certificate verify failed", str(exc.exception), f"{exc.exception}")

Expand All @@ -1169,7 +1171,8 @@ def test_ssl_client_profile_update(self):
atr = AsyncTestReceiver(f"amqps://localhost:{self.listener2_port}",
source="test/addr",
container_id="FooRx3",
conn_args=conn_args)
conn_args=conn_args,
print_to_console=True)
atr.stop()
self.assertIn("certificate verify failed", str(exc.exception), f"{exc.exception}")

Expand All @@ -1187,7 +1190,8 @@ def test_ssl_client_profile_update(self):
test_rx = AsyncTestReceiver(f"amqps://localhost:{self.listener1_port}",
source="test/addr",
container_id="FooRxOk",
conn_args=conn_args)
conn_args=conn_args,
print_to_console=True)

ssl_domain = SSLDomain(SSLDomain.MODE_CLIENT)
ssl_domain.set_trusted_ca_db(CA_CERT)
Expand Down

0 comments on commit 6969b68

Please sign in to comment.