Skip to content

Commit

Permalink
[6.11.z] Log end of test phases and broker host setup and teardown (#…
Browse files Browse the repository at this point in the history
…12495)

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 209f651)

Co-authored-by: Ondřej Gajdušek <ogajduse@redhat.com>
  • Loading branch information
Satellite-QE and ogajduse authored Sep 7, 2023
1 parent 6b8931d commit 2102bd7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pytest_plugins/logging_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 6 additions & 0 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2102bd7

Please sign in to comment.