diff --git a/plans/tier0.fmf b/plans/tier0.fmf index 91dcb09b86..cbcfb271ba 100644 --- a/plans/tier0.fmf +++ b/plans/tier0.fmf @@ -189,3 +189,29 @@ description+: | # Exclude the rhel_subman check, we don't use RHSM for the conversion exclude: - checks-after-conversion/rhel_subman + + /offline_system_analysis: + adjust+: + # Disabled due to known issue: https://issues.redhat.com/browse/RHELC-1040 + # Enable once this gets fixed + - enabled: false + when: distro == oracle-7 + environment+: + CONVERT2RHEL_OUTDATED_PACKAGE_CHECK_SKIP: 1 + when: distro == oracle-8 + because: | + The subman is installed from CentOS repo, resulting in outdated python3-ethtool + package which is then interfering with the test, inhibiting the conversion. + prepare+: + - name: Install subscription manager + how: ansible + playbook: tests/ansible_collections/roles/install-submgr/main.yml + - name: Allow access to Satellite only + how: shell + script: pytest --setup-show -svv tests/integration/*/destructive/offline-system-conversion/prepare_system.py + discover+: + test+<: + - offline-system-conversion/offline_system_analysis + # Exclude the rhel_subman check, we don't use RHSM for the conversion + exclude: + - checks-after-conversion/rhel_subman diff --git a/pytest.ini b/pytest.ini index fffde28740..10dfac4688 100644 --- a/pytest.ini +++ b/pytest.ini @@ -18,6 +18,7 @@ markers = test_satellite_conversion test_pre_registered_conversion test_offline_system_conversion + test_offline_system_analysis test_failures_and_skips_in_report test_successful_report test_convert_successful_report diff --git a/tests/integration/tier0/destructive/offline-system-conversion/main.fmf b/tests/integration/tier0/destructive/offline-system-conversion/main.fmf index 0303a52b0b..6642e9d13e 100644 --- a/tests/integration/tier0/destructive/offline-system-conversion/main.fmf +++ b/tests/integration/tier0/destructive/offline-system-conversion/main.fmf @@ -12,3 +12,6 @@ tag+: /offline_system_conversion: test: pytest -m test_offline_system_conversion + +/offline_system_analysis: + test: pytest -m test_offline_system_analysis diff --git a/tests/integration/tier0/destructive/offline-system-conversion/test_offline_system_analysis.py b/tests/integration/tier0/destructive/offline-system-conversion/test_offline_system_analysis.py new file mode 100644 index 0000000000..9a08c7eaed --- /dev/null +++ b/tests/integration/tier0/destructive/offline-system-conversion/test_offline_system_analysis.py @@ -0,0 +1,48 @@ +import pytest + +from conftest import TEST_VARS + + +def collect_enabled_repositories(shell): + """ + Collect the enabled repositories through a subscription-manager call. + + This function will return a list of repositories enabled. + """ + raw_output = shell("subscription-manager repos --list-enabled").output + assert raw_output + + enabled_repositories = [] + for line in raw_output.splitlines(): + if line.startswith("Repo ID:"): + # Get the repo_id as in that split it will be the last thing in the + # array. + repo_id = line.split("Repo ID:")[-1] + enabled_repositories.append(repo_id) + + return enabled_repositories + + +@pytest.mark.test_offline_system_analysis +def test_offline_system_analysis(convert2rhel): + """Test analysis systems not connected to the Internet but requiring sub-mgr (e.g. managed by Satellite). + + This test will perform the following operations: + - Collect the enabled repositories prior to the analysis start + - 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 + """ + + enabled_repositories_prior_analysis = collect_enabled_repositories() + + with convert2rhel( + "analysis -y -k {} -o {} --debug".format( + TEST_VARS["SATELLITE_KEY"], + TEST_VARS["SATELLITE_ORG"], + ) + ) as c2r: + c2r.expect("Rollback: Enabling RHSM repositories") + assert c2r.exitstatus == 0 + + enabled_repositories_after_analysis = collect_enabled_repositories() + assert enabled_repositories_prior_analysis == enabled_repositories_after_analysis