diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 1fe5974f69..d94d693b6a 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -806,7 +806,7 @@ def satellite_registration(shell, yum_conf_exclude, request): Register the system to the Satellite server By default it acquires the curl command from the satellite_curl_command function Can be parametrized with requesting a different key from the SAT_REG_FILE(.sat_reg_file): - @pytest.mark.parametrized("satellite_registration", ["DIFFERENT_KEY"], indirect=True) + @pytest.mark.parametrize("satellite_registration", ["DIFFERENT_KEY"], indirect=True) """ # Get the curl command for the respective system # from the conftest function diff --git a/tests/integration/tier0/non-destructive/enabled-repositories-after-analysis/test_enabled_repositories_after_analysis.py b/tests/integration/tier0/non-destructive/enabled-repositories-after-analysis/test_enabled_repositories_after_analysis.py index e1dd3b6abf..231833d46b 100644 --- a/tests/integration/tier0/non-destructive/enabled-repositories-after-analysis/test_enabled_repositories_after_analysis.py +++ b/tests/integration/tier0/non-destructive/enabled-repositories-after-analysis/test_enabled_repositories_after_analysis.py @@ -1,6 +1,9 @@ import pytest +RHEL_CERTIFICATE_69_PEM = "/usr/share/convert2rhel/rhel-certs/69.pem" + + def collect_enabled_repositories(shell): """ Collect the enabled repositories through a subscription-manager call. @@ -23,7 +26,10 @@ def collect_enabled_repositories(shell): @pytest.mark.test_enabled_repositories_after_analysis @pytest.mark.parametrize("satellite_registration", ["RHEL7_AND_CENTOS7_SAT_REG"], indirect=True) -def test_enabled_repositories_after_analysis(shell, convert2rhel, satellite_registration): +@pytest.mark.parametrize("rhel_repo_enabled", [False, True]) +def test_enabled_repositories_after_analysis( + shell, convert2rhel, satellite_registration, remove_repositories, rhel_repo_enabled +): """Test analysis systems not connected to the Internet but requiring sub-mgr (e.g. managed by Satellite). This test will perform the following operations: @@ -31,6 +37,17 @@ def test_enabled_repositories_after_analysis(shell, convert2rhel, satellite_regi - Run the analysis and assert that we successfully enabled the RHSM repositories - Collect the enabled repositories after the tool run to compare with the repositories prior to the analysis """ + + # Enable CentOS repos manually because they are disabled by default in our satellite instance + shell("subscription-manager repos --enable='Satellite_Engineering_CentOS_7_Updates_x86_64'") + shell("subscription-manager repos --enable='Satellite_Engineering_CentOS_7_Base_x86_64'") + + if rhel_repo_enabled: + # To enable RHEL repos we also need to put the 69.pem certificate to the + # appropriate location + shell(f"cp {RHEL_CERTIFICATE_69_PEM} /etc/pki/product-default/") + shell("subscription-manager repos --enable='rhel-7-server-rpms'") + enabled_repositories_prior_analysis = collect_enabled_repositories(shell) with convert2rhel("analyze -y --debug") as c2r: @@ -46,3 +63,9 @@ def test_enabled_repositories_after_analysis(shell, convert2rhel, satellite_regi # before the analysis. for repository in enabled_repositories_after_analysis: assert repository in enabled_repositories_prior_analysis + + if rhel_repo_enabled: + shell("rm -f /etc/pki/product-default/") + + # No error reported in the log + assert shell("grep ERROR '/var/log/convert2rhel/convert2rhel-pre-conversion.txt'").returncode == 1