From acb275645a0ba66859138fb17e503aabcb5a8a54 Mon Sep 17 00:00:00 2001 From: Shubham Ganar Date: Tue, 17 Dec 2024 18:16:12 +0530 Subject: [PATCH] Add RHEL10 support for Provisioning tests Signed-off-by: Shubham Ganar --- pytest_fixtures/component/provision_pxe.py | 43 +++++++++++-------- robottelo/constants/__init__.py | 43 +++++++++++++++++++ tests/foreman/api/test_provisioning.py | 13 +++--- tests/foreman/api/test_provisioning_puppet.py | 2 +- .../foreman/api/test_provisioningtemplate.py | 14 +++--- tests/foreman/cli/test_bootdisk.py | 2 +- .../cli/test_computeresource_libvirt.py | 2 +- .../foreman/cli/test_computeresource_rhev.py | 4 +- .../cli/test_computeresource_vmware.py | 2 +- .../ui/test_computeresource_libvirt.py | 2 +- 10 files changed, 89 insertions(+), 38 deletions(-) diff --git a/pytest_fixtures/component/provision_pxe.py b/pytest_fixtures/component/provision_pxe.py index ebacc9702df..ce0ed16e05c 100644 --- a/pytest_fixtures/component/provision_pxe.py +++ b/pytest_fixtures/component/provision_pxe.py @@ -12,6 +12,7 @@ from robottelo import constants from robottelo.config import settings from robottelo.hosts import ContentHost +from robottelo.utils.issue_handlers import is_open @pytest.fixture(scope='module') @@ -38,6 +39,10 @@ def module_provisioning_rhel_content( repo_names = [] if int(rhel_ver) <= 7: repo_names.append(f'rhel{rhel_ver}') + # Provision using RHEL10 Beta repos until its GA + elif int(rhel_ver) == 10: + repo_names.append(f'rhel{rhel_ver}_bos_beta') + repo_names.append(f'rhel{rhel_ver}_aps_beta') else: repo_names.append(f'rhel{rhel_ver}_bos') repo_names.append(f'rhel{rhel_ver}_aps') @@ -47,18 +52,19 @@ def module_provisioning_rhel_content( content_view = sat.api.ContentView(organization=module_sca_manifest_org).create() # Custom Content for Client repo - custom_product = sat.api.Product( - organization=module_sca_manifest_org, name=f'rhel{rhel_ver}_{gen_string("alpha")}' - ).create() - client_repo = sat.api.Repository( - organization=module_sca_manifest_org, - product=custom_product, - content_type='yum', - url=settings.repos.SATCLIENT_REPO[f'rhel{rhel_ver}'], - ).create() - task = client_repo.sync(synchronous=False) - tasks.append(task) - content_view.repository = [client_repo] + if is_open('SAT-27193'): + custom_product = sat.api.Product( + organization=module_sca_manifest_org, name=f'rhel{rhel_ver}_{gen_string("alpha")}' + ).create() + client_repo = sat.api.Repository( + organization=module_sca_manifest_org, + product=custom_product, + content_type='yum', + url=settings.repos.SATCLIENT_REPO[f'rhel{rhel_ver}'], + ).create() + task = client_repo.sync(synchronous=False) + tasks.append(task) + content_view.repository = [client_repo] for name in repo_names: rh_kickstart_repo_id = sat.api_factory.enable_rhrepo_and_fetchid( @@ -125,11 +131,14 @@ def module_provisioning_rhel_content( ).create() # Ensure client repo is enabled in the activation key - content = ak.product_content(data={'content_access_mode_all': '1'})['results'] - client_repo_label = [repo['label'] for repo in content if repo['name'] == client_repo.name][0] - ak.content_override( - data={'content_overrides': [{'content_label': client_repo_label, 'value': '1'}]} - ) + if is_open('SAT-27193'): + content = ak.product_content(data={'content_access_mode_all': '1'})['results'] + client_repo_label = [repo['label'] for repo in content if repo['name'] == client_repo.name][ + 0 + ] + ak.content_override( + data={'content_overrides': [{'content_label': client_repo_label, 'value': '1'}]} + ) return Box(os=os, ak=ak, ksrepo=ksrepo, cv=content_view) diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 76464b5fcf9..3d37af4a073 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -271,6 +271,7 @@ 'rhae': 'Red Hat Ansible Engine', 'rhel8': 'Red Hat Enterprise Linux for x86_64', 'rhel9': 'Red Hat Enterprise Linux for x86_64', + 'rhel10_beta': 'Red Hat Enterprise Linux for x86_64 Beta', } REPOSET = { @@ -303,11 +304,15 @@ 'rhel8_aps': 'Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart)', 'rhel9_bos': 'Red Hat Enterprise Linux 9 for x86_64 - BaseOS (Kickstart)', 'rhel9_aps': 'Red Hat Enterprise Linux 9 for x86_64 - AppStream (Kickstart)', + 'rhel10_bos_beta': 'Red Hat Enterprise Linux 10 for x86_64 - BaseOS Beta (Kickstart)', + 'rhel10_aps_beta': 'Red Hat Enterprise Linux 10 for x86_64 - AppStream Beta (Kickstart)', }, 'rhel8_bos': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)', 'rhel8_aps': 'Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)', 'rhel9_bos': 'Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)', 'rhel9_aps': 'Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)', + 'rhel10_bos_beta': 'Red Hat Enterprise Linux 10 for x86_64 - BaseOS Beta (RPMs)', + 'rhel10_aps_beta': 'Red Hat Enterprise Linux 10 for x86_64 - AppStream Beta (RPMs)', 'rhel7_extra': 'Red Hat Enterprise Linux 7 Server - Extras (RPMs)', 'rhel7_optional': 'Red Hat Enterprise Linux 7 Server - Optional (RPMs)', 'rhel7_sup': 'Red Hat Enterprise Linux 7 Server - Supplementary (RPMs)', @@ -558,6 +563,22 @@ 'product': PRDS['rhel9'], 'distro': 'rhel9', }, + 'rhel10_bos_beta': { + 'id': 'rhel-10-for-x86_64-baseos-beta-kickstart', + 'name': 'Red Hat Enterprise Linux 10 for x86_64 - BaseOS Beta Kickstart', + 'version': '10', + 'reposet': REPOSET['kickstart']['rhel10_bos_beta'], + 'product': PRDS['rhel10_beta'], + 'distro': 'rhel10', + }, + 'rhel10_aps_beta': { + 'id': 'rhel-10-for-x86_64-appstream-beta-kickstart', + 'name': 'Red Hat Enterprise Linux 10 for x86_64 - AppStream Beta Kickstart', + 'version': '10', + 'reposet': REPOSET['kickstart']['rhel10_aps_beta'], + 'product': PRDS['rhel10_beta'], + 'distro': 'rhel10', + }, }, 'rhel8_bos': { 'id': 'rhel-8-for-x86_64-baseos-rpms', @@ -603,6 +624,28 @@ 'distro': 'rhel9', 'key': 'rhel9_aps', }, + 'rhel10_bos_beta': { + 'id': 'rhel-10-for-x86_64-baseos-beta-rpms', + 'name': 'Red Hat Enterprise Linux 10 for x86_64 - BaseOS Beta RPMs', + 'releasever': '10', + 'version': '10', + 'reposet': REPOSET['rhel10_bos_beta'], + 'product': PRDS['rhel10_beta'], + 'distro': 'rhel10', + 'key': 'rhel10_bos_beta', + 'basearch': 'x86_64', + }, + 'rhel10_aps_beta': { + 'id': 'rhel-10-for-x86_64-appstream-beta-rpms', + 'name': 'Red Hat Enterprise Linux 10 for x86_64 - AppStream Beta RPMs', + 'releasever': '10', + 'basearch': 'x86_64', + 'version': '10', + 'reposet': REPOSET['rhel10_aps_beta'], + 'product': PRDS['rhel10_beta'], + 'distro': 'rhel10', + 'key': 'rhel10_aps_beta', + }, 'rhel7_optional': { 'id': 'rhel-7-server-optional-rpms', 'name': 'Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server', diff --git a/tests/foreman/api/test_provisioning.py b/tests/foreman/api/test_provisioning.py index 7c4a072a739..1f504976731 100644 --- a/tests/foreman/api/test_provisioning.py +++ b/tests/foreman/api/test_provisioning.py @@ -20,7 +20,6 @@ from wrapanapi.systems.virtualcenter import VMWareVirtualMachine from robottelo.config import settings -from robottelo.hosts import get_sat_rhel_version from robottelo.logging import logger from robottelo.utils.installer import InstallerCommand from robottelo.utils.issue_handlers import is_open @@ -66,7 +65,7 @@ def assert_host_logs(channel, pattern): @pytest.mark.upgrade @pytest.mark.parametrize('pxe_loader', ['bios', 'uefi'], indirect=True) @pytest.mark.on_premises_provisioning -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_rhel_pxe_provisioning( request, module_provisioning_sat, @@ -199,7 +198,7 @@ def test_rhel_pxe_provisioning( @pytest.mark.upgrade @pytest.mark.parametrize('pxe_loader', ['ipxe'], indirect=True) @pytest.mark.on_premises_provisioning -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_rhel_ipxe_provisioning( request, module_provisioning_sat, @@ -329,7 +328,7 @@ def test_rhel_ipxe_provisioning( @pytest.mark.upgrade @pytest.mark.parametrize('pxe_loader', ['http_uefi'], indirect=True) @pytest.mark.on_premises_provisioning -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_rhel_httpboot_provisioning( request, module_provisioning_sat, @@ -457,7 +456,7 @@ def test_rhel_httpboot_provisioning( @pytest.mark.parametrize('pxe_loader', ['bios', 'uefi'], indirect=True) @pytest.mark.on_premises_provisioning -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_rhel_pxe_provisioning_fips_enabled( request, module_provisioning_sat, @@ -599,7 +598,7 @@ def test_rhel_pxe_provisioning_fips_enabled( @pytest.mark.upgrade @pytest.mark.on_premises_provisioning @pytest.mark.parametrize('pxe_loader', ['secureboot'], indirect=True) -@pytest.mark.rhel_ver_match([get_sat_rhel_version().major]) +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_rhel_pxe_provisioning_secureboot_enabled( request, module_provisioning_sat, @@ -705,7 +704,7 @@ def test_rhel_pxe_provisioning_secureboot_enabled( @pytest.mark.parametrize('pxe_loader', ['bios', 'uefi'], indirect=True) @pytest.mark.skip(reason='Skipping till we have destructive support') @pytest.mark.on_premises_provisioning -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_capsule_pxe_provisioning( request, capsule_provisioning_sat, diff --git a/tests/foreman/api/test_provisioning_puppet.py b/tests/foreman/api/test_provisioning_puppet.py index 504fcb92bf3..0520fafd797 100644 --- a/tests/foreman/api/test_provisioning_puppet.py +++ b/tests/foreman/api/test_provisioning_puppet.py @@ -96,7 +96,7 @@ def test_positive_puppet_bootstrap( @pytest.mark.on_premises_provisioning -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_host_provisioning_with_external_puppetserver( request, external_puppet_server, diff --git a/tests/foreman/api/test_provisioningtemplate.py b/tests/foreman/api/test_provisioningtemplate.py index fb418177b38..2a4b4b7f786 100644 --- a/tests/foreman/api/test_provisioningtemplate.py +++ b/tests/foreman/api/test_provisioningtemplate.py @@ -242,7 +242,7 @@ def test_positive_build_pxe_default(self, tftpboot, module_target_sat): ) @pytest.mark.e2e - @pytest.mark.rhel_ver_match('[^6]') + @pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_positive_template_check_ipxe( self, module_sync_kickstart_content, @@ -290,7 +290,7 @@ def test_positive_template_check_ipxe( ks_param = 'ks=' if module_sync_kickstart_content.rhel_ver <= 8 else 'inst.ks=' assert ipxe_template.count(ks_param) == 1 - @pytest.mark.rhel_ver_match('[^6]') + @pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_positive_template_check_vlan_parameter( self, module_sync_kickstart_content, @@ -359,7 +359,7 @@ def test_positive_template_check_vlan_parameter( @pytest.mark.parametrize('pxe_loader', ['uefi'], indirect=True) @pytest.mark.parametrize('boot_mode', ['Static', 'DHCP']) - @pytest.mark.rhel_ver_match('[^6]') + @pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_positive_template_subnet_with_boot_mode( self, module_sync_kickstart_content, @@ -511,7 +511,7 @@ def test_positive_template_check_aap_snippet( assert f'"host_config_key":"{config_key}"' in render assert '{"package_install": "zsh"}' in render - @pytest.mark.rhel_ver_match('[^6]') + @pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_positive_template_check_rex_snippet( self, module_sync_kickstart_content, @@ -590,7 +590,7 @@ def test_positive_template_check_rex_snippet( ) assert ssh_key in rex_snippet - @pytest.mark.rhel_ver_match('[^6]') + @pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_positive_template_check_rex_pull_mode_snippet( self, module_sync_kickstart_content, @@ -651,7 +651,7 @@ def test_positive_template_check_rex_pull_mode_snippet( assert 'yggdrasil status' in rex_snippet assert 'Remote execution pull provider successfully configured!' in rex_snippet - @pytest.mark.rhel_ver_match('[^6]') + @pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_positive_template_check_fips_enabled( self, module_sync_kickstart_content, @@ -698,7 +698,7 @@ def test_positive_template_check_fips_enabled( render = host.read_template(data={'template_kind': kind})['template'] assert 'fips=1' in render - @pytest.mark.rhel_ver_match('[^6]') + @pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_positive_verify_chronyd_timesource_kickstart_template( self, module_sync_kickstart_content, diff --git a/tests/foreman/cli/test_bootdisk.py b/tests/foreman/cli/test_bootdisk.py index 7d9cf6ce70a..29ff73653b7 100644 --- a/tests/foreman/cli/test_bootdisk.py +++ b/tests/foreman/cli/test_bootdisk.py @@ -19,7 +19,7 @@ from robottelo.constants import HTTPS_MEDIUM_URL -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_positive_bootdisk_download_https( request, module_location, diff --git a/tests/foreman/cli/test_computeresource_libvirt.py b/tests/foreman/cli/test_computeresource_libvirt.py index 3e50461b7a1..fb9c29fd6c6 100644 --- a/tests/foreman/cli/test_computeresource_libvirt.py +++ b/tests/foreman/cli/test_computeresource_libvirt.py @@ -380,7 +380,7 @@ def test_positive_update_console_password(libvirt_url, set_console_password, mod @pytest.mark.e2e @pytest.mark.on_premises_provisioning @pytest.mark.tier3 -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') @pytest.mark.parametrize('setting_update', ['destroy_vm_on_host_delete=True'], indirect=True) def test_positive_provision_end_to_end( request, diff --git a/tests/foreman/cli/test_computeresource_rhev.py b/tests/foreman/cli/test_computeresource_rhev.py index dfa9900cb13..bc40a419701 100644 --- a/tests/foreman/cli/test_computeresource_rhev.py +++ b/tests/foreman/cli/test_computeresource_rhev.py @@ -371,7 +371,7 @@ def test_negative_add_image_rhev_with_invalid_name(rhev, module_os, module_targe @pytest.mark.e2e @pytest.mark.on_premises_provisioning @pytest.mark.tier3 -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') @pytest.mark.parametrize('setting_update', ['destroy_vm_on_host_delete=True'], indirect=True) def test_positive_provision_rhev_with_host_group( request, @@ -537,7 +537,7 @@ def test_positive_provision_rhev_without_host_group(rhev): @pytest.mark.on_premises_provisioning @pytest.mark.tier3 -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') @pytest.mark.parametrize('setting_update', ['destroy_vm_on_host_delete=True'], indirect=True) def test_positive_provision_rhev_image_based_and_disassociate( request, diff --git a/tests/foreman/cli/test_computeresource_vmware.py b/tests/foreman/cli/test_computeresource_vmware.py index f2490b3781a..16201702230 100644 --- a/tests/foreman/cli/test_computeresource_vmware.py +++ b/tests/foreman/cli/test_computeresource_vmware.py @@ -80,7 +80,7 @@ def test_positive_vmware_cr_end_to_end(target_sat, module_org, module_location, @pytest.mark.parametrize('vmware', ['vmware7', 'vmware8'], indirect=True) @pytest.mark.parametrize('pxe_loader', ['bios', 'uefi'], indirect=True) @pytest.mark.parametrize('provision_method', ['build', 'bootdisk']) -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') @pytest.mark.tier3 def test_positive_provision_end_to_end( request, diff --git a/tests/foreman/ui/test_computeresource_libvirt.py b/tests/foreman/ui/test_computeresource_libvirt.py index d5d8cbcb0d3..7047682c6ad 100644 --- a/tests/foreman/ui/test_computeresource_libvirt.py +++ b/tests/foreman/ui/test_computeresource_libvirt.py @@ -120,7 +120,7 @@ def test_positive_end_to_end(session, module_target_sat, module_org, module_loca @pytest.mark.e2e @pytest.mark.on_premises_provisioning @pytest.mark.tier4 -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') @pytest.mark.parametrize('setting_update', ['destroy_vm_on_host_delete=True'], indirect=True) def test_positive_provision_end_to_end( request,