Skip to content

Commit

Permalink
Assert installer succeeded
Browse files Browse the repository at this point in the history
If the installer failed, there's no point to continue. Since Foreman 3.8
it provides exactly which steps failed which is preferred over "parsing"
the log file.

Having an assertion in a fixture should result in the the test showing
up as ERROR.

Link: https://medium.com/opsops/pytest-fail-in-a-fixture-and-in-a-test-2122fab0564
Link: theforeman/foreman-installer@0d2fb67
  • Loading branch information
ekohl committed Dec 6, 2024
1 parent d3b6909 commit b08f7e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def installer_satellite(request):

sat.install_satellite_or_capsule_package()
# Install Satellite
sat.execute(
installer_result = sat.execute(
InstallerCommand(
installer_args=[
'scenario satellite',
Expand All @@ -394,6 +394,9 @@ def installer_satellite(request):
).get_command(),
timeout='30m',
)
# exit code 0 means no changes, 2 means changes were applied succesfully
assert installer_result.status in (0, 2), installer_result.stdout

sat.enable_satellite_ipv6_http_proxy()
if 'sanity' in request.config.option.markexpr:
configure_nailgun()
Expand Down

0 comments on commit b08f7e1

Please sign in to comment.