From 4ad612d1aa1673e201822f160d35e2907209b723 Mon Sep 17 00:00:00 2001 From: Jitendra Yejare Date: Wed, 18 Sep 2024 18:03:33 +0530 Subject: [PATCH] [Combined Jenkins Ask] Capsule testing for sanity (#15948) * Capsule Sanity Test from installer * Design Change: only count change * Satellite Maintain fapolicyd package installation (cherry picked from commit 723ec21d28725bb1a6f5eaab6bff34059b51308d) --- pytest_fixtures/core/sat_cap_factory.py | 9 ++++++--- tests/foreman/installer/test_installer.py | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/pytest_fixtures/core/sat_cap_factory.py b/pytest_fixtures/core/sat_cap_factory.py index 67198c65f72..ea88852f86a 100644 --- a/pytest_fixtures/core/sat_cap_factory.py +++ b/pytest_fixtures/core/sat_cap_factory.py @@ -314,10 +314,13 @@ def sat_ready_rhel(request): @pytest.fixture(scope='module') -def module_sat_ready_rhels(request): +def module_sat_ready_rhels(request, module_target_sat): deploy_args = get_deploy_args(request) - with Broker(**deploy_args, host_class=Satellite, _count=3) as hosts: - yield hosts + if 'build_sanity' not in request.config.option.markexpr: + with Broker(**deploy_args, host_class=Satellite, _count=3) as hosts: + yield hosts + else: + yield [module_target_sat] @pytest.fixture diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index d540dbdd528..02669f63dd2 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -135,10 +135,12 @@ def install_satellite(satellite, installer_args, enable_fapolicyd=False): snap=settings.server.version.snap, ) if enable_fapolicyd: - assert ( - satellite.execute('dnf -y install fapolicyd && systemctl enable --now fapolicyd').status - == 0 - ) + if satellite.execute('rpm -q satellite-maintain').status == 0: + # Installing the rpm on existing sat needs sat-maintain perms + cmmd = 'satellite-maintain packages install fapolicyd -y' + else: + cmmd = 'dnf -y install fapolicyd' + assert satellite.execute(f'{cmmd} && systemctl enable --now fapolicyd').status == 0 satellite.install_satellite_or_capsule_package() if enable_fapolicyd: assert satellite.execute('rpm -q foreman-fapolicyd').status == 0 @@ -269,8 +271,8 @@ def sat_default_install(module_sat_ready_rhels): 'scenario satellite', f'foreman-initial-admin-password {settings.server.admin_password}', ] - install_satellite(module_sat_ready_rhels[0], installer_args) - sat = module_sat_ready_rhels[0] + sat = module_sat_ready_rhels.pop() + install_satellite(sat, installer_args) sat.enable_ipv6_http_proxy() return sat @@ -282,8 +284,8 @@ def sat_fapolicyd_install(module_sat_ready_rhels): 'scenario satellite', f'foreman-initial-admin-password {settings.server.admin_password}', ] - install_satellite(module_sat_ready_rhels[1], installer_args, enable_fapolicyd=True) - sat = module_sat_ready_rhels[1] + sat = module_sat_ready_rhels.pop() + install_satellite(sat, installer_args, enable_fapolicyd=True) sat.enable_ipv6_http_proxy() return sat @@ -299,8 +301,8 @@ def sat_non_default_install(module_sat_ready_rhels): 'enable-foreman-plugin-discovery', 'foreman-proxy-plugin-discovery-install-images true', ] - install_satellite(module_sat_ready_rhels[2], installer_args, enable_fapolicyd=True) - sat = module_sat_ready_rhels[2] + sat = module_sat_ready_rhels.pop() + install_satellite(sat, installer_args, enable_fapolicyd=True) sat.enable_ipv6_http_proxy() sat.execute('dnf -y --disableplugin=foreman-protector install foreman-discovery-image') return sat @@ -309,6 +311,7 @@ def sat_non_default_install(module_sat_ready_rhels): @pytest.mark.e2e @pytest.mark.tier1 @pytest.mark.pit_server +@pytest.mark.build_sanity @pytest.mark.parametrize( 'setting_update', [f'http_proxy={settings.http_proxy.un_auth_proxy_url}'], indirect=True )