Skip to content

Commit

Permalink
Provide better error output for test_satellite_installation (#17105)
Browse files Browse the repository at this point in the history
(cherry picked from commit c170b84)
  • Loading branch information
ekohl authored and web-flow committed Dec 10, 2024
1 parent 9e14434 commit 1b9310f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
28 changes: 15 additions & 13 deletions pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,19 +364,18 @@ def installer_satellite(request):
# enable satellite repos
for repo in sat.SATELLITE_CDN_REPOS.values():
sat.enable_repo(repo, force=True)
elif settings.server.version.source == 'nightly':
sat.create_custom_repos(
satellite_repo=settings.repos.satellite_repo,
satmaintenance_repo=settings.repos.satmaintenance_repo,
)
else:
if settings.server.version.source == 'nightly':
sat.create_custom_repos(
satellite_repo=settings.repos.satellite_repo,
satmaintenance_repo=settings.repos.satmaintenance_repo,
)
else:
# get ohsnap repofile
sat.download_repofile(
product='satellite',
release=settings.server.version.release,
snap=settings.server.version.snap,
)
# get ohsnap repofile
sat.download_repofile(
product='satellite',
release=settings.server.version.release,
snap=settings.server.version.snap,
)

if settings.robottelo.rhel_source == "internal":
# disable rhel repos from cdn
Expand All @@ -386,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 @@ -395,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
10 changes: 5 additions & 5 deletions tests/foreman/installer/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,22 @@ def common_sat_install_assertions(satellite):
result = satellite.execute(
r'journalctl --quiet --no-pager --boot --priority err -u "dynflow-sidekiq*" -u "foreman-proxy" -u "foreman" -u "httpd" -u "postgresql" -u "pulpcore-api" -u "pulpcore-content" -u "pulpcore-worker*" -u "redis" -u "tomcat"'
)
assert len(result.stdout) == 0
assert not result.stdout
# no errors in /var/log/foreman/production.log
result = satellite.execute(r'grep --context=100 -E "\[E\|" /var/log/foreman/production.log')
if not is_open('SAT-21086'):
assert len(result.stdout) == 0
assert not result.stdout
# no errors/failures in /var/log/foreman-installer/satellite.log
result = satellite.execute(
r'grep "\[ERROR" --context=100 /var/log/foreman-installer/satellite.log'
)
assert len(result.stdout) == 0
assert not result.stdout
# no errors/failures in /var/log/httpd/*
result = satellite.execute(r'grep -iR "error" /var/log/httpd/*')
assert len(result.stdout) == 0
assert not result.stdout
# no errors/failures in /var/log/candlepin/*
result = satellite.execute(r'grep -iR "error" /var/log/candlepin/*')
assert len(result.stdout) == 0
assert not result.stdout

httpd_log = satellite.execute('journalctl --unit=httpd')
assert "WARNING" not in httpd_log.stdout
Expand Down

0 comments on commit 1b9310f

Please sign in to comment.