[freeipa PR#4528][opened] ipatests: Collect all logs on all Unix hosts
by stanislavlevin
URL: https://github.com/freeipa/freeipa/pull/4528
Author: stanislavlevin
Title: #4528: ipatests: Collect all logs on all Unix hosts
Action: opened
PR body:
"""
Each integration test entity sets up its own list of logfiles. This is made by calling the callback of host's 'collect_log', which knows nothing about the context of execution: whether it's the test class scope or the test method one. Of course, in this case one-time collection of test method log is not supported because the logs tracker collects only test class logs.
In the meantime, almost all the entities (except 'client') collect identical logs. Besides, due to the IPA roles transformation an each IPA host can become master, replica or client, all of these, in turn, can have subroles. So, the most common case is the collection of all the possible logs from all the IPA (Unix) hosts. However, the customization of a logfiles collection is possible.
The collection is performed with the help of 'integration_logs' fixture. For example, to add a log file to a list of logs on a test completion one should add the dependency on this fixture and call its 'collect_method_log' method.
```
class TestFoo(IntegrationTest):
def test_foo(self):
pass
def test_bar(self, integration_logs):
integration_logs.collect_method_log(self.master, '/logfile')
```
Collected logs:
1) 'test_foo' - default logs
2) 'test_bar' - default logs + /logfile
3) 'TestFoo' - default logs
Also, this updated the default list of log files (added missing ones).
"""
To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/4528/head:pr4528
git checkout pr4528
4 years, 1 month