From 84193f4a482c45a79fe8b8440011271a1ca0eb70 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 10 Dec 2024 11:49:07 +0100 Subject: [PATCH] Provide better error output for test_satellite_installation (#17105) (cherry picked from commit c170b84214e2ce4928af4ca744a64df6c37ee607) --- pytest_fixtures/core/sat_cap_factory.py | 28 ++++++++++++----------- tests/foreman/installer/test_installer.py | 10 ++++---- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/pytest_fixtures/core/sat_cap_factory.py b/pytest_fixtures/core/sat_cap_factory.py index 5c5cd66318b..6a7a5310119 100644 --- a/pytest_fixtures/core/sat_cap_factory.py +++ b/pytest_fixtures/core/sat_cap_factory.py @@ -350,23 +350,22 @@ 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, + ) sat.install_satellite_or_capsule_package() # Install Satellite - sat.execute( + installer_result = sat.execute( InstallerCommand( installer_args=[ 'scenario satellite', @@ -375,6 +374,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 + if 'sanity' in request.config.option.markexpr: configure_nailgun() configure_airgun() diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index 70286d8c246..9fea61f2f36 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -1327,22 +1327,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 result = satellite.cli.Health.check() assert 'FAIL' not in result.stdout