From 2102bd7e7f5b29c09db6951b82160eeee6244c32 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Thu, 7 Sep 2023 05:41:02 -0400 Subject: [PATCH] [6.11.z] Log end of test phases and broker host setup and teardown (#12495) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Log end of test phases and broker host setup and teardown (#12472) * Log broker host setup and teardown * Log result of each pytest node phase at its end (cherry picked from commit 209f6511f8a56ac6937af608c07aa5febcba4a18) Co-authored-by: Ondřej Gajdušek --- pytest_plugins/logging_hooks.py | 6 ++++-- robottelo/hosts.py | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pytest_plugins/logging_hooks.py b/pytest_plugins/logging_hooks.py index f7bcaf43620..1cf24d89ee1 100644 --- a/pytest_plugins/logging_hooks.py +++ b/pytest_plugins/logging_hooks.py @@ -73,5 +73,7 @@ def pytest_runtest_logstart(nodeid, location): logger.info(f'Started Test: {nodeid}') -def pytest_runtest_logfinish(nodeid, location): - logger.info(f'Finished Test: {nodeid}') +def pytest_runtest_logreport(report): + """Process the TestReport produced for each of the setup, + call and teardown runtest phases of an item.""" + logger.info('Finished %s for test: %s, result: %s', report.when, report.nodeid, report.outcome) diff --git a/robottelo/hosts.py b/robottelo/hosts.py index f2d9b50269b..b0c2c765fc4 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -326,15 +326,21 @@ def clean_cached_properties(self): del self.__dict__[name] def setup(self): + logger.debug('START: setting up host %s', self) if not self.blank: self.remove_katello_ca() + logger.debug('END: setting up host %s', self) + def teardown(self): + logger.debug('START: tearing down host %s', self) if not self.blank and not getattr(self, '_skip_context_checkin', False): self.unregister() if type(self) is not Satellite and self.nailgun_host: self.nailgun_host.delete() + logger.debug('END: tearing down host %s', self) + def power_control(self, state=VmState.RUNNING, ensure=True): """Lookup the host workflow for power on and execute