You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2021/12/16 15:16:37 UTC
[GitHub] [qpid-dispatch] ganeshmurthy opened a new pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
ganeshmurthy opened a new pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463
…e. Also a minor fix to the connection creation code
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] ganeshmurthy commented on a change in pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
ganeshmurthy commented on a change in pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463#discussion_r770870878
##########
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)
Review comment:
Unfortunately there is not. We could query the connection again to find out but even if that has the correct value of enableProtocolTrace, it does not guarantee that the action actually has executed. See here - https://github.com/apache/qpid-dispatch/blob/main/src/router_core/agent_connection.c#L644
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] jiridanek commented on a change in pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
jiridanek commented on a change in pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463#discussion_r770859406
##########
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")
+ 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_after_update += 1
- self.assertTrue(mau_found)
+ # Since there will be no transfer frames printed in the log, there should be no more new transfers in the
+ # log file.
+ self.assertEqual(num_transfers_after_update, num_transfers)
- # Turn off trace logging for the inter-router connection
- qd_manager.update("org.apache.qpid.dispatch.connection", {"enableProtocolTrace": "no"}, identity=conn_id)
+ # Turn on trace logging for the inter-router connection
+ qd_manager.update("org.apache.qpid.dispatch.connection", {"enableProtocolTrace": "yes"}, identity=conn_id)
# Create a receiver and make sure the MAU update is NOT seen on the inter-router connection log
TEST_ADDR_2 = "EnableConnectionLevelProtocolTraceTest2"
conn_1 = BlockingConnection(self.address)
- blocking_receiver_2 = conn_1.create_receiver(address=TEST_ADDR_2)
+ conn_1.create_receiver(address=TEST_ADDR_2)
- time.sleep(1)
+ #Give time for the MAU to be generated.
+ 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_2 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:
and ditto here, if you decide to try the iterator-over-lines
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
kgiusti commented on a change in pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463#discussion_r770898797
##########
File path: tests/system_tests_log_level_update.py
##########
@@ -256,56 +256,72 @@ 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:
+ for log_line in router_log:
+ log_components = log_line.split(" ")
+ if len(log_components) > 2 and 'PROTOCOL' in log_components[3]:
Review comment:
Uh, apparently my comments are in reverse order from above (?)
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] jiridanek commented on a change in pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] codecov-commenter commented on pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463#issuecomment-996102406
# [Codecov](https://codecov.io/gh/apache/qpid-dispatch/pull/1463?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1463](https://codecov.io/gh/apache/qpid-dispatch/pull/1463?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c719631) into [main](https://codecov.io/gh/apache/qpid-dispatch/commit/c6d3d96ee0beb853385bb6858bb2d776e1e5f4a8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c6d3d96) will **decrease** coverage by `0.05%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/apache/qpid-dispatch/pull/1463?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## main #1463 +/- ##
==========================================
- Coverage 84.82% 84.77% -0.06%
==========================================
Files 116 116
Lines 28620 28623 +3
==========================================
- Hits 24277 24265 -12
- Misses 4343 4358 +15
```
| [Impacted Files](https://codecov.io/gh/apache/qpid-dispatch/pull/1463?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [src/router\_core/connections.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1463/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL2Nvbm5lY3Rpb25zLmM=) | `89.18% <100.00%> (-0.93%)` | :arrow_down: |
| [src/adaptors/tcp\_adaptor.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1463/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL2FkYXB0b3JzL3RjcF9hZGFwdG9yLmM=) | `76.87% <0.00%> (-0.53%)` | :arrow_down: |
| [src/hash.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1463/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL2hhc2guYw==) | `79.53% <0.00%> (-0.47%)` | :arrow_down: |
| [src/router\_node.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1463/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9ub2RlLmM=) | `93.55% <0.00%> (-0.10%)` | :arrow_down: |
| [src/router\_core/transfer.c](https://codecov.io/gh/apache/qpid-dispatch/pull/1463/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL3JvdXRlcl9jb3JlL3RyYW5zZmVyLmM=) | `95.03% <0.00%> (+0.43%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/qpid-dispatch/pull/1463?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/qpid-dispatch/pull/1463?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [c6d3d96...c719631](https://codecov.io/gh/apache/qpid-dispatch/pull/1463?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] jiridanek commented on a change in pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
jiridanek commented on a change in pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463#discussion_r770856177
##########
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")
Review comment:
```suggestion
log_lines = router_log.readlines()
```
?
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] asfgit merged pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
asfgit merged pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
kgiusti commented on a change in pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463#discussion_r770897086
##########
File path: tests/system_tests_log_level_update.py
##########
@@ -256,56 +256,72 @@ 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:
+ for log_line in router_log:
+ log_components = log_line.split(" ")
+ if len(log_components) > 2 and 'PROTOCOL' in log_components[3]:
+ if inter_router_cid in log_components[5] and '@transfer' in log_components[8]:
+ 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
-
- self.assertTrue(mau_found)
+ num_transfers_after_update = 0
+ with open(self.routers[1].logfile_path) as router_log:
+ for log_line in router_log:
+ log_components = log_line.split(" ")
+ if len(log_components) > 2 and 'PROTOCOL' in log_components[3]:
+ if inter_router_cid in log_components[5] and '@transfer' in log_components[8]:
+ num_transfers_after_update += 1
+
+ # Since there will be no transfer frames printed in the log, there should be no more new transfers in the
+ # log file.
+ self.assertEqual(num_transfers_after_update, num_transfers)
- # Turn off trace logging for the inter-router connection
- qd_manager.update("org.apache.qpid.dispatch.connection", {"enableProtocolTrace": "no"}, identity=conn_id)
+ # Turn on trace logging for the inter-router connection
+ qd_manager.update("org.apache.qpid.dispatch.connection", {"enableProtocolTrace": "yes"}, identity=conn_id)
# Create a receiver and make sure the MAU update is NOT seen on the inter-router connection log
TEST_ADDR_2 = "EnableConnectionLevelProtocolTraceTest2"
conn_1 = BlockingConnection(self.address)
- blocking_receiver_2 = conn_1.create_receiver(address=TEST_ADDR_2)
+ conn_1.create_receiver(address=TEST_ADDR_2)
- time.sleep(1)
+ #Give time for the MAU to be generated.
+ 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_2 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:
+ for log_line in router_log:
+ log_components = log_line.split(" ")
+ if len(log_components) > 2 and 'PROTOCOL' in log_components[3]:
Review comment:
and here as well (maybe make the count code a private method to this test so you don't have to copy & pasta it multiple times).
##########
File path: tests/system_tests_log_level_update.py
##########
@@ -256,56 +256,72 @@ 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:
+ for log_line in router_log:
+ log_components = log_line.split(" ")
+ if len(log_components) > 2 and 'PROTOCOL' in log_components[3]:
+ if inter_router_cid in log_components[5] and '@transfer' in log_components[8]:
+ 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
-
- self.assertTrue(mau_found)
+ num_transfers_after_update = 0
+ with open(self.routers[1].logfile_path) as router_log:
+ for log_line in router_log:
+ log_components = log_line.split(" ")
+ if len(log_components) > 2 and 'PROTOCOL' in log_components[3]:
Review comment:
ditto len(log_components) here as well.
##########
File path: tests/system_tests_log_level_update.py
##########
@@ -256,56 +256,72 @@ 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:
+ for log_line in router_log:
+ log_components = log_line.split(" ")
+ if len(log_components) > 2 and 'PROTOCOL' in log_components[3]:
Review comment:
I think you meant to check len(log_components) > 8, so indexing log_components[8] won't barf? or at minimum > 3 if you're willing to trust the format of the PROTOCOL log statement.
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] jiridanek commented on a change in pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
jiridanek commented on a change in pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463#discussion_r770857275
##########
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")
Review comment:
```suggestion
for log_line in router_log:
```
Actually, this is what you want. Open file is an iterator over its lines, in Python.
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] [qpid-dispatch] jiridanek commented on a change in pull request #1463: DISPATCH-2300: Fixed test to not look for contents of transfer messag…
Posted by GitBox <gi...@apache.org>.
jiridanek commented on a change in pull request #1463:
URL: https://github.com/apache/qpid-dispatch/pull/1463#discussion_r770855217
##########
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)
Review comment:
Is there a way to either wait for completion of the async operation or possibly repeatedly query for the current state until the change happens? Just asking.
--
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: dev-unsubscribe@qpid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org