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 2020/02/21 14:09:32 UTC
[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #691: DISPATCH-1561: Added a test that makes sure that different modules ca…
kgiusti commented on a change in pull request #691: DISPATCH-1561: Added a test that makes sure that different modules ca…
URL: https://github.com/apache/qpid-dispatch/pull/691#discussion_r382599824
##########
File path: tests/system_tests_log_level_update.py
##########
@@ -29,6 +29,102 @@
apply_options = AtMostOnce()
+class ManyLogFilesTest(TestCase):
+ @classmethod
+ def setUpClass(cls):
+ super(ManyLogFilesTest, cls).setUpClass()
+ name = "test-router"
+ LogLevelUpdateTest.listen_port = cls.tester.get_port()
+ config = Qdrouterd.Config([
+ ('router', {'mode': 'standalone', 'id': 'QDR'}),
+ ('listener', {'port': LogLevelUpdateTest.listen_port}),
+
+ ('address', {'prefix': 'closest', 'distribution': 'closest'}),
+ ('address', {'prefix': 'balanced', 'distribution': 'balanced'}),
+ ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
+
+ # We are sending three different module trace logs to three different
+ # files and we will make sure that these files exist and these
+ # files contain only logs pertinent to the module in question
+ ('log', {'module': 'SERVER', 'enable': 'trace+',
+ 'includeSource': 'true', 'outputFile': name + '-server.log'}),
+ ('log', {'module': 'ROUTER_CORE', 'enable': 'trace+',
+ 'includeSource': 'true',
+ 'outputFile': name + '-core.log'}),
+ ('log', {'module': 'PROTOCOL', 'enable': 'trace+',
+ 'includeSource': 'true',
+ 'outputFile': name + '-protocol.log'}),
+
+ # try two modules to the same file.
+ # Put the ROUTER_CORE and ROUTER module logs into the same log file
+ ('log', {'module': 'ROUTER', 'enable': 'trace+',
+ 'includeSource': 'true',
+ 'outputFile': name + '-core.log'}),
+
+ ])
+ cls.router = cls.tester.qdrouterd(name, config)
+ cls.router.wait_ready()
+ cls.address = cls.router.addresses[0]
+
+ def test_multiple_log_file(self):
+ blocking_connection = BlockingConnection(self.address)
+
+ TEST_ADDRESS = "test_multiple_log_file"
+
+ blocking_receiver = blocking_connection.create_receiver(address=TEST_ADDRESS)
+ blocking_sender = blocking_connection.create_sender(address=TEST_ADDRESS, options=apply_options)
+
+ TEST_MSG = "LOGTEST"
+ msg = Message(body=TEST_MSG)
+ blocking_sender.send(msg)
+ received_message = blocking_receiver.receive()
+ self.assertEqual(TEST_MSG, received_message.body)
+ server_log_found = True
+ all_server_logs = True
+ try:
+ with open('../setUpClass/test-router-server.log', 'r') as server_log:
Review comment:
One totally optional suggestion - I *think* that the Qdrouter class stores the full path to the log files in the ".outdir" member [see the Process class in system_test.py]. Use that to access the logs rather than the hardcoded relative path (less brittle).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org