diff --git a/plans/tier0.fmf b/plans/tier0.fmf index a82298f952..ceadeb4c94 100644 --- a/plans/tier0.fmf +++ b/plans/tier0.fmf @@ -154,8 +154,8 @@ description+: | /resolve_dependency: adjust+: - enabled: true - when: distro == centos, oracle - because: We do not have any tracked packages with Rocky and Alma for this test case + when: distro == centos, oracle and distro != oracle-9 + because: We do not have any tracked packages for Alma, Rocky or Oracle Linux 9 for this test case summary+: | Handle dependency packages description+: | diff --git a/plans/tier1.fmf b/plans/tier1.fmf index d02402da54..90db6c709c 100644 --- a/plans/tier1.fmf +++ b/plans/tier1.fmf @@ -185,6 +185,10 @@ description+: | - changed-grub-file/valid_changes_to_grub_file /changed_grub_invalid: + adjust+: + - enabled: false + when: distro == alma-8-latest and boot_method == uefi or distro == alma-9 + because: The changes to the grub file result in a unbootable system. discover+: test+<: - changed-grub-file/invalid_changes_to_grub_file diff --git a/tests/ansible_collections/roles/install-submgr/install_submgr_from_centos_8.yml b/tests/ansible_collections/roles/install-submgr/install_submgr_from_centos_8.yml deleted file mode 100644 index abbcf20eed..0000000000 --- a/tests/ansible_collections/roles/install-submgr/install_submgr_from_centos_8.yml +++ /dev/null @@ -1,15 +0,0 @@ -- hosts: all - tasks: - - name: Add the CentOS Linux 8 BaseOS repo - yum_repository: - name: baseos - description: CentOS Linux 8 BaseOS - baseurl: https://vault.centos.org/centos/8/BaseOS/x86_64/os/ - gpgcheck: no - - - name: Install subscription-manager from the CentOS Linux 8 BaseOS repo (signed by CentOS) - yum: - name: subscription-manager - disablerepo: "*" - enablerepo: "baseos" - state: present diff --git a/tests/ansible_collections/roles/install-submgr/install_submgr_from_ubi_7.yml b/tests/ansible_collections/roles/install-submgr/install_submgr_from_ubi_7.yml deleted file mode 100644 index 19e89b14ed..0000000000 --- a/tests/ansible_collections/roles/install-submgr/install_submgr_from_ubi_7.yml +++ /dev/null @@ -1,15 +0,0 @@ -- hosts: all - tasks: - - name: Add the Universal Base Image 7 repo - yum_repository: - name: ubi - description: Universal Base Image 7 - baseurl: https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi/server/7/7Server/x86_64/os/ - gpgcheck: no - - - name: Install subscription-manager from the UBI repo (signed by Red Hat) - yum: - name: subscription-manager - disablerepo: "*" - enablerepo: "ubi" - state: present diff --git a/tests/ansible_collections/roles/install-submgr/main.yml b/tests/ansible_collections/roles/install-submgr/main.yml deleted file mode 100644 index 1c7ecd2b8d..0000000000 --- a/tests/ansible_collections/roles/install-submgr/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- hosts: all - gather_facts: yes - become: false - # On Oracle Linux 7 a "rhn-client-tols" package may be present on - # the system which prevents "subscription-manager" to be installed -- import_playbook: remove_rhn_client_tools.yml - when: ansible_facts['distribution_major_version'] == "7" and ansible_facts['distribution'] == "OracleLinux" -- import_playbook: install_submgr_from_ubi_7.yml - when: ansible_facts['distribution_major_version'] == "7" -- import_playbook: install_submgr_from_centos_8.yml - when: ansible_facts['distribution_major_version'] == "8" diff --git a/tests/ansible_collections/roles/install-submgr/remove_rhn_client_tools.yml b/tests/ansible_collections/roles/install-submgr/remove_rhn_client_tools.yml deleted file mode 100644 index 77799e814d..0000000000 --- a/tests/ansible_collections/roles/install-submgr/remove_rhn_client_tools.yml +++ /dev/null @@ -1,6 +0,0 @@ -- hosts: all - tasks: - - name: remove rhn client tools - yum: - name: rhn-client-tools - state: absent diff --git a/tests/ansible_collections/roles/oracle-linux-specific/tasks/boot_standard_kernel.yml b/tests/ansible_collections/roles/oracle-linux-specific/tasks/boot_standard_kernel.yml index 0158ad8471..8b687fc408 100644 --- a/tests/ansible_collections/roles/oracle-linux-specific/tasks/boot_standard_kernel.yml +++ b/tests/ansible_collections/roles/oracle-linux-specific/tasks/boot_standard_kernel.yml @@ -14,8 +14,17 @@ - name: Set default kernel to Red Hat compatible kernel shell: "grubby --set-default /boot/vmlinuz-{{ kernel_ver.stdout }}" -# On OL9 the grubby call is not recognized for some reason -# Set the entry manually just as a safety measure -- name: Set the default kernel manually for OL9 - shell: 'grub2-set-default "Oracle Linux Server ({{ kernel_ver.stdout }}) {{ ansible_distribution_version }}"' +# On OL9 the /etc/default/grub might be configured in a way, that it's not possible to boot +# into the RHCK (Red Hat Compatible Kernel), fix that here +- name: Set the /etc/grub/default + lineinfile: + path: /etc/default/grub + line: '{{ item }}' + insertafter: EOF + loop: + - 'GRUB_ENABLE_BLSCFG=true' + - 'GRUB_TERMINAL_OUTPUT="console"' when: ansible_distribution == "OracleLinux" and ansible_distribution_major_version == "9" + +- name: Run grub2-mkconfig + shell: grub2-mkconfig -o /boot/grub2/grub.cfg diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index c40efa1261..db0fdcadbc 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -35,13 +35,18 @@ SAT_REG_COMMAND = { "alma-8-latest": SAT_REG_FILE["ALMA8_SAT_REG"], + "alma-9-latest": SAT_REG_FILE["ALMA9_SAT_REG"], "alma-8.8": SAT_REG_FILE["ALMA88_SAT_REG"], "rocky-8-latest": SAT_REG_FILE["ROCKY8_SAT_REG"], "rocky-8.8": SAT_REG_FILE["ROCKY88_SAT_REG"], + "rocky-9-latest": SAT_REG_FILE["ROCKY9_SAT_REG"], "oracle-8-latest": SAT_REG_FILE["ORACLE8_SAT_REG"], + "oracle-9-latest": SAT_REG_FILE["ORACLE9_SAT_REG"], "centos-8-latest": SAT_REG_FILE["CENTOS8_SAT_REG"], "oracle-7": SAT_REG_FILE["ORACLE7_SAT_REG"], "centos-7": SAT_REG_FILE["CENTOS7_SAT_REG"], + "stream-8-latest": SAT_REG_FILE["STREAM8_SAT_REG"], + "stream-9-latest": SAT_REG_FILE["STREAM9_SAT_REG"], } @@ -476,13 +481,13 @@ def _load_json_schema(path): @pytest.fixture -def pre_registered(shell, request, yum_conf_exclude): +def pre_registered(shell, request): """ A fixture to install subscription manager and pre-register the system prior to the convert2rhel run. For Oracle Linux we're using the _add_client_tools_repo_oracle to enable the client-tools repository to install the subscription-manager package from. - We also exclude the rhn-client* packages for the same reason. - On Oracle Linux subscription-manger is obsolete and replaced by rhn-client* packages when installing subman. + We call the subman installation with the no obsolete flag to be able to install the package even on Oracle Linux + where the subscription-manger is obsolete and replaced by rhn-client* packages when installing subman. By default, the RHSM_USERNAME and RHSM_PASSWORD is passed to the subman registration. Can be parametrized by requesting a different KEY from the TEST_VARS file. @pytest.mark.parametrize("pre_registered", [("DIFFERENT_USERNAME", "DIFFERENT_PASSWORD")], indirect=True) @@ -497,13 +502,10 @@ def pre_registered(shell, request, yum_conf_exclude): print(">>> Using parametrized username and password requested in the fixture.") if "oracle" in SYSTEM_RELEASE_ENV: - # Remove the rhn-client-tools package to make way for subscription-manager installation - # given subman is obsoleted by the rhn-client-tools on Oracle - shell("yum remove -y rhn-client-tools") # Add the client-tools repository for Oracle linux to install subscription-manager from _add_client_tools_repo(shell) - assert shell("yum install -y subscription-manager").returncode == 0 + assert shell("yum install --setopt=obsoletes=0 -y subscription-manager").returncode == 0 # The SSL certificate for accessing cdn.redhat.com is intentionally missing from # the subscription-manager-rhsm-certificates package on CentOS Linux 7 shell( @@ -733,38 +735,32 @@ def yum_conf_exclude(shell, backup_directory, request): def test_function(yum_conf_exclude): """ - # We need to do this only for Oracle Linux - # rhn* is one of the excluded packages in convert2rhel configs - # so if the package is present on the system, is excluded in yum.conf - # and convert2rhel tries to back it up by calling yumdownloader - # it fails to do so because the call conflicts with the exclude option - if "oracle" in SYSTEM_RELEASE_ENV: - exclude = ["rhn-client*"] - if hasattr(request, "param"): - exclude = request.param - print(">>> Using parametrized packages requested in the fixture.") - yum_config = "/etc/yum.conf" - backup_dir = os.path.join(backup_directory, "yumconf") - shell(f"mkdir -v {backup_dir}") - config_bak = os.path.join(backup_dir, os.path.basename(yum_config)) - config = configparser.ConfigParser() - config.read(yum_config) - - assert shell(f"cp -v {yum_config} {config_bak}").returncode == 0 - - pkgs_to_exclude = " ".join(exclude) - # If there is already an `exclude` section, append to the existing value - if config.has_option("main", "exclude"): - pre_existing_value = config.get("main", "exclude") - config.set("main", "exclude", f"{pre_existing_value} {pkgs_to_exclude}") - else: - config.set("main", "exclude", pkgs_to_exclude) + exclude = [""] + if hasattr(request, "param"): + exclude = request.param + print(">>> Using parametrized packages requested in the fixture.") + yum_config = "/etc/yum.conf" + backup_dir = os.path.join(backup_directory, "yumconf") + shell(f"mkdir -v {backup_dir}") + config_bak = os.path.join(backup_dir, os.path.basename(yum_config)) + config = configparser.ConfigParser() + config.read(yum_config) + + assert shell(f"cp -v {yum_config} {config_bak}").returncode == 0 + + pkgs_to_exclude = " ".join(exclude) + # If there is already an `exclude` section, append to the existing value + if config.has_option("main", "exclude"): + pre_existing_value = config.get("main", "exclude") + config.set("main", "exclude", f"{pre_existing_value} {pkgs_to_exclude}") + else: + config.set("main", "exclude", pkgs_to_exclude) - with open(yum_config, "w") as configfile: - config.write(configfile, space_around_delimiters=False) + with open(yum_config, "w") as configfile: + config.write(configfile, space_around_delimiters=False) - assert config.has_option("main", "exclude") - assert all(pkg in config.get("main", "exclude") for pkg in exclude) + assert config.has_option("main", "exclude") + assert all(pkg in config.get("main", "exclude") for pkg in exclude) yield @@ -809,7 +805,7 @@ def _remove_client_tools_repo(shell): @pytest.fixture -def satellite_registration(shell, yum_conf_exclude, request): +def satellite_registration(shell, request): """ Fixture Register the system to the Satellite server @@ -879,7 +875,7 @@ def backup_directory(shell, request): @pytest.fixture() -def install_and_set_up_subman_to_stagecdn(shell, yum_conf_exclude): +def install_and_set_up_subman_to_stagecdn(shell): """ " A fixture to install subscription-manager and set up to point to a testing environments. rhsm.baseurl and server.hostname to be changed. @@ -888,11 +884,7 @@ def install_and_set_up_subman_to_stagecdn(shell, yum_conf_exclude): # Add the client tools repository to install the subscription-manager from # This is mainly for Oracle Linux but does not hurt to do the same for CentOS as well _add_client_tools_repo(shell) - # Since we're using the yum_conf_exclude fixture, which excludes rhn-client* - # by default, we need to remove the pacakge to prevent issues during the yum transaction - if SystemInformationRelease.distribution == "oracle": - shell("yum remove -y rhn-client*") - shell(f"yum install subscription-manager -y") + shell(f"yum install --setopt=obsoletes=0 subscription-manager -y") # Point the server hostname to the staging environment, # so we don't need to pass it to convert2rhel explicitly diff --git a/tests/integration/tier0/non-destructive/duplicate-pkgs/main.fmf b/tests/integration/tier0/non-destructive/duplicate-pkgs/main.fmf index 51689a1cc0..f526cff33a 100644 --- a/tests/integration/tier0/non-destructive/duplicate-pkgs/main.fmf +++ b/tests/integration/tier0/non-destructive/duplicate-pkgs/main.fmf @@ -8,9 +8,10 @@ description+: | /duplicate-pkgs: link: https://issues.redhat.com/browse/RHELC-1070 + enabled: false adjust+: - - enabled: false - when: distro == centos-8, alma-8, rocky-8, oracle-8 + - enabled: true + when: distro == centos-7, oracle-7 because: | The bug is reproducible only on EL7 distros. On EL8 the issue is handled by the DNF itself. diff --git a/tests/integration/tier0/non-destructive/kernel/test_custom_kernel.py b/tests/integration/tier0/non-destructive/kernel/test_custom_kernel.py index 3e205584a5..cc14da1ad2 100644 --- a/tests/integration/tier0/non-destructive/kernel/test_custom_kernel.py +++ b/tests/integration/tier0/non-destructive/kernel/test_custom_kernel.py @@ -1,56 +1,70 @@ import os +import re import pexpect.exceptions import pytest -from conftest import SYSTEM_RELEASE_ENV - - -ORIGINAL_KERNEL = os.popen("rpm -q --last kernel | head -1 | cut -d ' ' -f1").read() - -DISTRO_KERNEL_MAPPING = { - "centos-7": { - "original_kernel": f"{ORIGINAL_KERNEL}", - "custom_kernel": "https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/kernel-3.10.0-1160.76.1.0.1.el7.x86_64.rpm", - "grub_substring": "CentOS Linux (3.10.0-1160.76.1.0.1.el7.x86_64) 7 (Core)", - }, - # We hardcode original kernel for CentOS 8.5 as it won't receive any updates anymore - "centos-8-latest": { - "original_kernel": "kernel-core-4.18.0-348.7.1.el8_5.x86_64", - "custom_kernel": "https://yum.oracle.com/repo/OracleLinux/OL8/5/baseos/base/x86_64/getPackage/kernel-core-4.18.0-348.el8.x86_64.rpm", - "grub_substring": "Oracle Linux Server (4.18.0-348.el8.x86_64) 8.5", - }, - "oracle-7": { - "original_kernel": f"{ORIGINAL_KERNEL}", - "custom_kernel": "http://mirror.centos.org/centos/7/os/x86_64/Packages/kernel-3.10.0-1160.el7.x86_64.rpm", - "grub_substring": "Oracle Linux Server 7.9, with Linux 3.10.0-1160.el7.x86_64", - }, - # Install CentOS 8.5 kernel - "oracle-8-latest": { - "original_kernel": f"{ORIGINAL_KERNEL}", - "custom_kernel": "https://vault.centos.org/centos/8.5.2111/BaseOS/x86_64/os/Packages/kernel-core-4.18.0-348.7.1.el8_5.x86_64.rpm", - "grub_substring": "CentOS Linux (4.18.0-348.7.1.el8_5.x86_64) 8", - }, - "alma-8": { - "original_kernel": f"{ORIGINAL_KERNEL}", - "custom_kernel": "https://yum.oracle.com/repo/OracleLinux/OL8/5/baseos/base/x86_64/getPackage/kernel-core-4.18.0-348.el8.x86_64.rpm", - "grub_substring": "Oracle Linux Server (4.18.0-348.el8.x86_64) 8.5", - }, - "rocky-8": { - "original_kernel": f"{ORIGINAL_KERNEL}", - "custom_kernel": "https://yum.oracle.com/repo/OracleLinux/OL8/5/baseos/base/x86_64/getPackage/kernel-core-4.18.0-348.el8.x86_64.rpm", - "grub_substring": "Oracle Linux Server (4.18.0-348.el8.x86_64) 8.5", - }, -} - -if "alma-8" in SYSTEM_RELEASE_ENV: - distro = "alma-8" -elif "rocky" in SYSTEM_RELEASE_ENV: - distro = "rocky-8" -else: - distro = SYSTEM_RELEASE_ENV - -_, CUSTOM_KERNEL, GRUB_SUBSTRING = DISTRO_KERNEL_MAPPING[distro].values() +from conftest import SYSTEM_RELEASE_ENV, SystemInformationRelease + + +def _cross_vendor_kernel(): + """ + Helper function to assign a cross vendor kernel. + Example: + Running on CentOS 7, we install the Oracle Linux 7 signed kernel. + distro == centos-7 + install_what = oracle-7-kernel + """ + + # This mapping includes cross vendor kernels and their respective grub substrings to set for boot + INSTALL_WHAT_KERNEL_MAPPING = { + "oracle-7-kernel": { + "custom_kernel": "https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/kernel-3.10.0-1160.76.1.0.1.el7.x86_64.rpm", + "grub_substring": "CentOS Linux (3.10.0-1160.76.1.0.1.el7.x86_64) 7 (Core)", + }, + "centos-7-kernel": { + "custom_kernel": "http://mirror.centos.org/centos/7/os/x86_64/Packages/kernel-3.10.0-1160.el7.x86_64.rpm", + "grub_substring": "Oracle Linux Server 7.9, with Linux 3.10.0-1160.el7.x86_64", + }, + "oracle-8-kernel": { + "custom_kernel": "https://yum.oracle.com/repo/OracleLinux/OL8/5/baseos/base/x86_64/getPackage/kernel-core-4.18.0-348.el8.x86_64.rpm", + "grub_substring": "Oracle Linux Server (4.18.0-348.el8.x86_64) 8.5", + }, + "centos-8-kernel": { + "custom_kernel": "https://vault.centos.org/centos/8.5.2111/BaseOS/x86_64/os/Packages/kernel-core-4.18.0-348.7.1.el8_5.x86_64.rpm", + "grub_substring": "CentOS Linux (4.18.0-348.7.1.el8_5.x86_64) 8", + }, + "stream-9-kernel": { + "custom_kernel": "https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/kernel-5.14.0-457.el9.x86_64.rpm", + "grub_substring": "CentOS Stream (5.14.0-457.el9.x86_64.rpm) 9", + }, + "alma-9-kernel": { + "custom_kernel": "https://repo.almalinux.org/almalinux/9.4/BaseOS/x86_64/os/Packages/kernel-5.14.0-427.20.1.el9_4.x86_64.rpm", + "grub_substring": "AlmaLinux (5.14.0-427.20.1.el9_4.x86_64) 9.4 (Seafoam Ocelot)", + }, + } + + distro = f"{SystemInformationRelease.distribution}-{SystemInformationRelease.version.major}" + + install_what = "" + # Based on a current OS we decide which cross vendor kernel to install + # install_what variable indicates that + if distro == "oracle-7": + install_what = "centos-7-kernel" + elif distro == "centos-7": + install_what = "oracle-7-kernel" + elif re.match(r"^(alma|rocky|centos|stream)-8", distro): + install_what = "oracle-8-kernel" + elif distro == "oracle-8": + install_what = "centos-8-kernel" + elif re.match(r"^(alma|rocky|centos|oracle)-9", distro): + install_what = "stream-9-kernel" + elif distro == "stream-9": + install_what = "alma-9-kernel" + + custom_kernel, grub_substring = INSTALL_WHAT_KERNEL_MAPPING[install_what].values() + + return custom_kernel, grub_substring @pytest.fixture(scope="function") @@ -62,11 +76,12 @@ def custom_kernel(shell, hybrid_rocky_image): Remove the current installed kernel and install the machine default kernel after the test. """ + custom_kernel, grub_substring = _cross_vendor_kernel() if os.environ["TMT_REBOOT_COUNT"] == "0": - assert shell("yum install %s -y" % CUSTOM_KERNEL).returncode == 0 + assert shell("yum install %s -y" % custom_kernel).returncode == 0 - assert shell("grub2-set-default '%s'" % GRUB_SUBSTRING).returncode == 0 + assert shell("grub2-set-default '%s'" % grub_substring).returncode == 0 shell("tmt-reboot -t 600") @@ -74,7 +89,7 @@ def custom_kernel(shell, hybrid_rocky_image): if os.environ["TMT_REBOOT_COUNT"] == "1": # Remove the current installed kernel and install the machine default kernel. - custom_kernel_release = CUSTOM_KERNEL.rsplit("/", 1)[-1].replace(".rpm", "") + custom_kernel_release = custom_kernel.rsplit("/", 1)[-1].replace(".rpm", "") assert shell("rpm -e %s" % custom_kernel_release).returncode == 0 original_kernel = os.popen("rpm -q --last kernel | head -1 | cut -d ' ' -f1").read() diff --git a/tests/integration/tier0/non-destructive/rollback-handling/test_rollback_handling.py b/tests/integration/tier0/non-destructive/rollback-handling/test_rollback_handling.py index 336aa778b0..57a95d0d79 100644 --- a/tests/integration/tier0/non-destructive/rollback-handling/test_rollback_handling.py +++ b/tests/integration/tier0/non-destructive/rollback-handling/test_rollback_handling.py @@ -37,8 +37,8 @@ def assign_packages(packages=None): packages = ["usermode", "rhn-setup"] # The packages 'python-syspurpose' and 'python3-syspurpose' were removed in Oracle Linux 7.9 - # and Oracle Linux 8.2 respectively. - if not os_distribution == "oracle": + # and Oracle Linux 8.2 respectively, the package is also not present in EL9 systems + if os_distribution != "oracle" or os_version == 9: python_ver = "" if os_version > 7: python_ver = "3" diff --git a/tests/integration/tier1/destructive/proxy-conversion/test_proxy_conversion.py b/tests/integration/tier1/destructive/proxy-conversion/test_proxy_conversion.py index 1cfa806960..4b53e8981c 100644 --- a/tests/integration/tier1/destructive/proxy-conversion/test_proxy_conversion.py +++ b/tests/integration/tier1/destructive/proxy-conversion/test_proxy_conversion.py @@ -1,3 +1,4 @@ +import re import socket import pytest @@ -93,36 +94,29 @@ def setup_rhsm(shell): ).returncode == 0 ) - if SYSTEM_RELEASE_ENV in ("centos-7", "oracle-7"): - assert ( - shell( - f"curl -o /etc/yum.repos.d/client-tools.repo https://cdn-public.redhat.com/content/public/repofiles/client-tools-for-rhel-7-server.repo \ - --proxy http://{TEST_VARS['PROXY_SERVER']}:{TEST_VARS['PROXY_PORT']}", - silent=True, - ).returncode - == 0 - ) - else: - assert ( - shell( - f"curl -o /etc/yum.repos.d/client-tools.repo https://cdn-public.redhat.com/content/public/repofiles/client-tools-for-rhel-8.repo \ - --proxy http://{TEST_VARS['PROXY_SERVER']}:{TEST_VARS['PROXY_PORT']}", - silent=True, - ).returncode - == 0 - ) - # On CentOS 8.5 we need to replace the $releasever in the url to 8.5, - # otherwise the dnf will complain with dependency issues. - if "centos-8" in SYSTEM_RELEASE_ENV: - shell("sed -i 's#\$releasever#8.5#' /etc/yum.repos.d/client-tools.repo") + + client_tools_repo = "" + if re.match(r"^(centos|oracle)-7", SYSTEM_RELEASE_ENV): + client_tools_repo = "client-tools-for-rhel-7-server.repo" + elif re.match(r"^(alma|centos|oracle|rocky|stream)-8", SYSTEM_RELEASE_ENV): + client_tools_repo = "client-tools-for-rhel-8.repo" + elif re.match(r"^(alma|oracle|rocky|stream)-9", SYSTEM_RELEASE_ENV): + client_tools_repo = "client-tools-for-rhel-9.repo" + + ct_repo_shell_call = f"curl -o /etc/yum.repos.d/client-tools.repo https://cdn-public.redhat.com/content/public/repofiles/{client_tools_repo} \ + --proxy http://{TEST_VARS['PROXY_SERVER']}:{TEST_VARS['PROXY_PORT']}" + + assert shell(ct_repo_shell_call, silent=True).returncode == 0 + + # On CentOS 8.5 we need to replace the $releasever in the url to 8.5, + # otherwise the dnf will complain with dependency issues. + if "centos-8" in SYSTEM_RELEASE_ENV: + shell("sed -i 's#\$releasever#8.5#' /etc/yum.repos.d/client-tools.repo") # On Oracle Linux 7 a "rhn-client-tools" package may be present on # the system which prevents "subscription-manager" to be installed. - if "oracle" in SYSTEM_RELEASE_ENV: - shell("yum remove rhn-client-tools -y") - shell("echo 'exclude=rhn-client*' >> /etc/yum.conf") - - shell("yum -y install subscription-manager subscription-manager-rhsm-certificates") + # Run the yum install call with no obsoletes flag. + shell("yum -y install --setopt=obsoletes=0 subscription-manager subscription-manager-rhsm-certificates") shell( f"subscription-manager config --server.proxy_hostname={TEST_VARS['PROXY_SERVER']} --server.proxy_port={TEST_VARS['PROXY_PORT']}", diff --git a/tests/integration/tier1/destructive/set-locale/use_non_english_language.py b/tests/integration/tier1/destructive/set-locale/use_non_english_language.py index f067b63388..6df8002568 100644 --- a/tests/integration/tier1/destructive/set-locale/use_non_english_language.py +++ b/tests/integration/tier1/destructive/set-locale/use_non_english_language.py @@ -11,7 +11,7 @@ def test_use_non_english_language(shell): """ # install Chinese language pack for CentOS-8 and Oracle Linux 8 - if re.match(r"^(centos|oracle|alma|rocky)-8", SYSTEM_RELEASE_ENV): + if re.match(r"^(centos|oracle|alma|rocky)-[89]", SYSTEM_RELEASE_ENV): assert shell("dnf install glibc-langpack-zh -y").returncode == 0 # set locale variables that affect translations to Chinese diff --git a/tests/integration/tier1/destructive/system-not-up-to-date/test_system_not_up_to_date.py b/tests/integration/tier1/destructive/system-not-up-to-date/test_system_not_up_to_date.py index e8982dc125..0461e8c861 100644 --- a/tests/integration/tier1/destructive/system-not-up-to-date/test_system_not_up_to_date.py +++ b/tests/integration/tier1/destructive/system-not-up-to-date/test_system_not_up_to_date.py @@ -1,8 +1,9 @@ import os +import re import pytest -from conftest import SYSTEM_RELEASE_ENV, TEST_VARS +from conftest import TEST_VARS, SystemInformationRelease @pytest.fixture() @@ -18,20 +19,18 @@ def downgrade_and_versionlock(shell): """ # On some systems we cannot do the downgrade as the repos contain only the latest package version. # We need to install package from older repository as a workaround. - centos_8_pkg_url = "https://vault.centos.org/8.1.1911/BaseOS/x86_64/os/Packages/wpa_supplicant-2.7-1.el8.x86_64.rpm" - alma_8eus_pkg_url = ( - "https://repo.almalinux.org/vault/8.3/BaseOS/x86_64/os/Packages/wpa_supplicant-2.9-2.el8_3.1.x86_64.rpm" - ) - rocky_8eus_pkg_url = ( - "https://dl.rockylinux.org/vault/rocky/8.3/BaseOS/x86_64/os/Packages/wpa_supplicant-2.9-2.el8.1.x86_64.rpm" - ) + older_packages_mapping = { + "centos-8": "https://vault.centos.org/8.1.1911/BaseOS/x86_64/os/Packages/wpa_supplicant-2.7-1.el8.x86_64.rpm", + "almalinux-8": "https://repo.almalinux.org/vault/8.3/BaseOS/x86_64/os/Packages/wpa_supplicant-2.9-2.el8_3.1.x86_64.rpm", + "rocky-8": "https://dl.rockylinux.org/vault/rocky/8.3/BaseOS/x86_64/os/Packages/wpa_supplicant-2.9-2.el8.1.x86_64.rpm", + "almalinux-9": "https://vault.almalinux.org/9.2/BaseOS/x86_64/os/Packages/wpa_supplicant-2.10-4.el9.x86_64.rpm", + "rocky-9": "https://download.rockylinux.org/vault/rocky/9.2/BaseOS/x86_64/os/Packages/w/wpa_supplicant-2.10-4.el9.x86_64.rpm", + } - if "centos-8" in SYSTEM_RELEASE_ENV: - assert shell("yum install -y {}".format(centos_8_pkg_url)).returncode == 0 - elif "alma-8" in SYSTEM_RELEASE_ENV: - assert shell("yum install -y {}".format(alma_8eus_pkg_url)).returncode == 0 - elif "rocky-8" in SYSTEM_RELEASE_ENV: - assert shell("yum install -y {}".format(rocky_8eus_pkg_url)).returncode == 0 + os_key = f"{SystemInformationRelease.distribution}-{SystemInformationRelease.version.major}" + + if re.match(r"^(almalinux|centos|rocky)-[89]", os_key): + assert shell("yum install -y {}".format(older_packages_mapping.get(os_key))).returncode == 0 else: assert shell("yum install openldap wpa_supplicant sqlite -y").returncode == 0 # Try to downgrade some packages.