jiridanek commented on a change in pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463#discussion_r770857939
##########
File path: tests/system_tests_log_level_update.py
##########
@@ -256,56 +256,69 @@ def router(name, connection):
def test_inter_router_protocol_trace(self):
qd_manager = QdManager(self, self.address)
- # Turn off trace logging on all connections for Router B.
- qd_manager.update("org.apache.qpid.dispatch.log", {"enable": "info+"},
- name="log/DEFAULT")
+ # The router already has trace logging turned on for all connections.
# Get the connection id of the inter-router connection
results = qd_manager.query("org.apache.qpid.dispatch.connection")
conn_id = None
for result in results:
if result['role'] == 'inter-router':
conn_id = result['identity']
- # Turn on trace logging for the inter-router connection
- qd_manager.update("org.apache.qpid.dispatch.connection",
{"enableProtocolTrace": "true"}, identity=conn_id)
+ # Turn off trace logging for the inter-router connection. This update
command is run async by the router
+ # so we need to sleep a bit before the operation is actually completed.
+ qd_manager.update("org.apache.qpid.dispatch.connection",
{"enableProtocolTrace": "false"}, identity=conn_id)
+ time.sleep(1)
- # Create a receiver and make sure the MAU update is seen on the
inter-router connection log
+ inter_router_cid = "[C" + conn_id + "]"
+
+ num_transfers = 0
+ with open(self.routers[1].logfile_path) as router_log:
+ log_lines = router_log.read().split("\n")
+ for log_line in log_lines:
+ if 'PROTOCOL' in log_line and inter_router_cid in log_line and
'@transfer' in log_line:
+ num_transfers += 1
+
+ # Create a receiver. This will send an MAU update to the other router
but we should not see any of that
+ # in the log since the trace logging for the inter-router connection
has been turned off.
TEST_ADDR_1 = "EnableConnectionLevelProtocolTraceTest1"
conn_2 = BlockingConnection(self.address)
- blocking_receiver_1 = conn_2.create_receiver(address=TEST_ADDR_1)
-
- # Give some time for the MAU to go over the inter-router link
+ conn_2.create_receiver(address=TEST_ADDR_1)
+ # Give some time for the MAU to go over the inter-router connection.
time.sleep(2)
- logs = qd_manager.get_log()
- mau_found = False
- for log in logs:
- if 'PROTOCOL' in log[0]:
- if "@transfer" in log[2] and TEST_ADDR_1 in log[2] and "MAU"
in log[2]:
- mau_found = True
- break
+ num_transfers_after_update = 0
+ with open(self.routers[1].logfile_path) as router_log:
+ log_lines = router_log.read().split("\n")
Review comment:
same as before, this helper variable is not necessary
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]