diff --git a/pytest_fixtures/core/contenthosts.py b/pytest_fixtures/core/contenthosts.py index 50579027fd..d8b2c02f90 100644 --- a/pytest_fixtures/core/contenthosts.py +++ b/pytest_fixtures/core/contenthosts.py @@ -101,27 +101,6 @@ def rhel9_contenthost(request): yield host -@pytest.fixture(scope='module', params=[{'rhel_version': '9'}]) -def rhel9_contenthost_module(request): - """A module-level fixture that provides a rhel9 content host object""" - with Broker(**host_conf(request), host_class=ContentHost) as host: - yield host - - -@pytest.fixture(params=[{'rhel_version': '10'}]) -def rhel10_contenthost(request): - """A fixture that provides a rhel10 content host object""" - with Broker(**host_conf(request), host_class=ContentHost) as host: - yield host - - -@pytest.fixture(scope='module', params=[{'rhel_version': '10'}]) -def rhel10_contenthost_module(request): - """A module-level fixture that provides a rhel10 content host object""" - with Broker(**host_conf(request), host_class=ContentHost) as host: - yield host - - @pytest.fixture def content_hosts(request): """A function-level fixture that provides two rhel content hosts object""" diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 60444b0787..41b9efab57 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -891,12 +891,6 @@ REAL_RHEL8_1_PACKAGE_NAME = 'puppet-agent' # for RHSA-2022:4867 REAL_RHEL8_1_PACKAGE_FILENAME = 'puppet-agent-6.19.1-1.el8sat.x86_64' REAL_RHEL8_2_PACKAGE_FILENAME = 'puppet-agent-6.26.0-1.el8sat.x86_64' -REAL_RHEL9_PACKAGE_NAME = '' -REAL_RHEL9_1_PACKAGE_FILENAME = '' -REAL_RHEL9_2_PACKAGE_FILENAME = '' -REAL_RHEL10_PACKAGE_NAME = '' -REAL_RHEL10_1_PACKAGE_FILENAME = '' -REAL_RHEL10_2_PACKAGE_FILENAME = '' # TODO: Add when updated packages are available for RHEL10 FAKE_0_CUSTOM_PACKAGE_GROUP_NAME = 'birds' FAKE_3_YUM_OUTDATED_PACKAGES = [ 'acme-package-1.0.1-1.noarch', @@ -953,10 +947,6 @@ REAL_RHEL7_1_ERRATA_ID = 'RHBA-2017:0395' # tcsh bug fix update REAL_RHEL8_1_ERRATA_ID = 'RHSA-2022:4867' # for REAL_RHEL8_1_PACKAGE REAL_RHEL8_ERRATA_CVES = ['CVE-2021-27023', 'CVE-2021-27025'] -REAL_RHEL9_ERRATA_ID = '' # for rhel9 RH package -REAL_RHEL9_ERRATA_CVES = [] -REAL_RHEL10_ERRATA_ID = '' # TODO: add when real errata is available for RHEL10 -REAL_RHEL10_ERRATA_CVES = [] REAL_RHSCLIENT_ERRATA = 'RHSA-2023:5982' # for RH Satellite Client 8 FAKE_1_YUM_REPOS_COUNT = 32 FAKE_3_YUM_REPOS_COUNT = 78 diff --git a/tests/foreman/api/test_ansible.py b/tests/foreman/api/test_ansible.py index 528a55e978..7e75c187a9 100644 --- a/tests/foreman/api/test_ansible.py +++ b/tests/foreman/api/test_ansible.py @@ -412,7 +412,6 @@ def test_positive_ansible_job_on_multiple_host( self, target_sat, module_org, - rhel10_contenthost, rhel9_contenthost, rhel8_contenthost, rhel7_contenthost, @@ -438,7 +437,7 @@ def test_positive_ansible_job_on_multiple_host( :BZ: 2167396, 2190464, 2184117 """ - hosts = [rhel10_contenthost, rhel9_contenthost, rhel8_contenthost, rhel7_contenthost] + hosts = [rhel9_contenthost, rhel8_contenthost, rhel7_contenthost] SELECTED_ROLE = 'RedHatInsights.insights-client' for host in hosts: result = host.register( @@ -477,11 +476,11 @@ def test_positive_ansible_job_on_multiple_host( ) target_sat.wait_for_tasks( f'resource_type = JobInvocation and resource_id = {job["id"]}', - poll_timeout=1500, + poll_timeout=1000, must_succeed=False, ) result = target_sat.api.JobInvocation(id=job['id']).read() - assert result.succeeded == len(hosts) - 1 # SELECTED_ROLE working on rhel8/9/10 clients + assert result.succeeded == 2 # SELECTED_ROLE working on rhel8/rhel9 clients assert result.failed == 1 # SELECTED_ROLE failing on rhel7 client assert result.status_label == 'failed' diff --git a/tests/foreman/api/test_capsulecontent.py b/tests/foreman/api/test_capsulecontent.py index 775d903b05..07a1b5be6b 100644 --- a/tests/foreman/api/test_capsulecontent.py +++ b/tests/foreman/api/test_capsulecontent.py @@ -1453,7 +1453,7 @@ def test_positive_remove_capsule_orphans( ], indirect=True, ) - @pytest.mark.rhel_ver_list([settings.content_host.default_rhel_version]) + @pytest.mark.rhel_ver_match('N-0') def test_complete_sync_fixes_metadata( self, module_target_sat, diff --git a/tests/foreman/api/test_errata.py b/tests/foreman/api/test_errata.py index 4b04b25bd7..c43d72e762 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -1068,8 +1068,9 @@ def setup_rhel_content( @pytest.mark.tier2 +@pytest.mark.rhel_ver_match('8') def test_positive_get_count_for_host( - setup_rhel_content, activation_key, rhel9_contenthost, module_target_sat + setup_rhel_content, activation_key, rhel_contenthost, module_target_sat ): """Available errata count when retrieving Host @@ -1094,7 +1095,7 @@ def test_positive_get_count_for_host( :CaseImportance: Medium """ - chost = rhel9_contenthost + chost = rhel_contenthost org = setup_rhel_content['organization'] custom_repo = setup_rhel_content['rh_repo'] chost.create_custom_repos(**{f'{custom_repo.name}': custom_repo.url}) @@ -1127,18 +1128,18 @@ def test_positive_get_count_for_host( assert result.status == 0, f'Failed to install package {FAKE_1_CUSTOM_PACKAGE}' _validate_errata_counts(host, errata_type='security', expected_value=1) # rh_repo outdated Puppet-agent - # TODO: Use REAL_RHEL 9 or 10 Packages - '''result = chost.execute(f'yum install -y {REAL_RHEL8_1_PACKAGE_FILENAME}') + result = chost.execute(f'yum install -y {REAL_RHEL8_1_PACKAGE_FILENAME}') assert result.status == 0, f'Failed to install package {REAL_RHEL8_1_PACKAGE_FILENAME}' _validate_errata_counts(host, errata_type='security', expected_value=2) # All avaliable errata present - assert chost.applicable_errata_count == 4''' + assert chost.applicable_errata_count == 4 @pytest.mark.upgrade @pytest.mark.tier3 +@pytest.mark.rhel_ver_match('8') def test_positive_get_applicable_for_host( - setup_rhel_content, activation_key, rhel10_contenthost, target_sat + setup_rhel_content, activation_key, rhel_contenthost, target_sat ): """Get applicable errata ids for a host @@ -1164,7 +1165,7 @@ def test_positive_get_applicable_for_host( """ org = setup_rhel_content['organization'] custom_repo = setup_rhel_content['rh_repo'] - chost = rhel10_contenthost + chost = rhel_contenthost chost.create_custom_repos(**{f'{custom_repo.name}': custom_repo.url}) result = chost.register( @@ -1195,10 +1196,10 @@ def test_positive_get_applicable_for_host( assert len(erratum) == 1 assert CUSTOM_REPO_ERRATA_ID in [errata['errata_id'] for errata in erratum] # Install outdated applicable real package (from RH repo) - '''chost.run(f'yum install -y {REAL_RHEL8_1_PACKAGE_FILENAME}') + chost.run(f'yum install -y {REAL_RHEL8_1_PACKAGE_FILENAME}') erratum = _fetch_available_errata(host, 2) assert len(erratum) == 2 - assert REAL_RHEL8_1_ERRATA_ID in [errata['errata_id'] for errata in erratum]''' + assert REAL_RHEL8_1_ERRATA_ID in [errata['errata_id'] for errata in erratum] @pytest.mark.tier3 @@ -1256,13 +1257,14 @@ def test_positive_get_diff_for_cv_envs(target_sat): @pytest.mark.tier3 +@pytest.mark.rhel_ver_match('8') def test_positive_incremental_update_required( module_sca_manifest_org, module_lce, activation_key, module_cv, rh_repo_module_manifest, - rhel9_contenthost, + rhel_contenthost, target_sat, ): """Given a set of hosts and errata, check for content view version @@ -1293,7 +1295,7 @@ def test_positive_incremental_update_required( :BZ: 2013093 """ - chost = rhel9_contenthost + chost = rhel_contenthost org = module_sca_manifest_org rh_repo = target_sat.api.Repository( id=rh_repo_module_manifest.id, @@ -1374,10 +1376,11 @@ def rh_repo_module_manifest(module_sca_manifest_org, module_target_sat): @pytest.mark.tier3 +@pytest.mark.rhel_ver_match('N-1') def test_positive_incremental_update_apply_to_envs_cvs( target_sat, module_sca_manifest_org, - rhel10_contenthost, + rhel_contenthost, module_product, ): """With multiple environments and content views, register a host to one, @@ -1408,7 +1411,7 @@ def test_positive_incremental_update_apply_to_envs_cvs( incremental version of the content-view. """ - chost = rhel10_contenthost + chost = rhel_contenthost # any existing custom CVs in org, except Default CV prior_cv_count = ( len(target_sat.api.ContentView(organization=module_sca_manifest_org).search()) - 1 diff --git a/tests/foreman/api/test_provisioning_puppet.py b/tests/foreman/api/test_provisioning_puppet.py index 1b45247f7a..d1f6018e63 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(r'^(?!.*fips).*$') # all versions, excluding any 'fips' +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') def test_host_provisioning_with_external_puppetserver( request, external_puppet_server, diff --git a/tests/foreman/ui/test_contenthost.py b/tests/foreman/ui/test_contenthost.py index 8b7b7e1282..bc4134c70f 100644 --- a/tests/foreman/ui/test_contenthost.py +++ b/tests/foreman/ui/test_contenthost.py @@ -37,8 +37,6 @@ if not setting_is_set('fake_manifest'): pytest.skip('skipping tests due to missing settings', allow_module_level=True) -CHOST_RHEL_VER = 'rhel10' - @pytest.fixture(scope='module', autouse=True) def host_ui_default(module_target_sat): @@ -65,20 +63,20 @@ def module_org(module_target_sat): @pytest.fixture -def vm(module_repos_collection_with_manifest, rhel10_contenthost, target_sat): +def vm(module_repos_collection_with_manifest, rhel7_contenthost, target_sat): """Virtual machine registered in satellite""" - module_repos_collection_with_manifest.setup_virtual_machine(rhel10_contenthost) - rhel10_contenthost.add_rex_key(target_sat) - rhel10_contenthost.run(r'subscription-manager repos --enable \*') - return rhel10_contenthost + module_repos_collection_with_manifest.setup_virtual_machine(rhel7_contenthost) + rhel7_contenthost.add_rex_key(target_sat) + rhel7_contenthost.run(r'subscription-manager repos --enable \*') + return rhel7_contenthost @pytest.fixture -def vm_module_streams(module_repos_collection_with_manifest, rhel10_contenthost, target_sat): +def vm_module_streams(module_repos_collection_with_manifest, rhel8_contenthost, target_sat): """Virtual machine registered in satellite""" - module_repos_collection_with_manifest.setup_virtual_machine(rhel10_contenthost) - rhel10_contenthost.add_rex_key(satellite=target_sat) - return rhel10_contenthost + module_repos_collection_with_manifest.setup_virtual_machine(rhel8_contenthost) + rhel8_contenthost.add_rex_key(satellite=target_sat) + return rhel8_contenthost def set_ignore_facts_for_os(module_target_sat, value=False): @@ -130,7 +128,9 @@ def get_rhel_lifecycle_support(rhel_version): 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -152,7 +152,7 @@ def test_positive_end_to_end( :id: f43f2826-47c1-4069-9c9d-2410fd1b622c - :setup: Register a rhel vm as a content host. Import repos + :setup: Register a rhel7 vm as a content host. Import repos collection and associated manifest. :steps: @@ -253,7 +253,9 @@ def test_positive_end_to_end( 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -336,7 +338,9 @@ def test_positive_end_to_end_bulk_update(session, default_location, vm, target_s 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -373,7 +377,9 @@ def test_negative_install_package(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -408,7 +414,9 @@ def test_positive_remove_package(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -444,7 +452,9 @@ def test_positive_upgrade_package(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -481,7 +491,9 @@ def test_positive_install_package_group(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -516,7 +528,9 @@ def test_positive_remove_package_group(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -558,7 +572,9 @@ def test_positive_search_errata_non_admin( 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -616,7 +632,9 @@ def test_positive_ensure_errata_applicability_with_host_reregistered(session, de 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -674,7 +692,9 @@ def test_positive_host_re_registration_with_host_rename( 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -763,10 +783,11 @@ def test_positive_check_ignore_facts_os_setting( 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel8', 'YumRepository': [ - {'url': settings.repos.rhel10_os.baseos}, - {'url': settings.repos.rhel10_os.appstream}, + {'url': settings.repos.rhel8_os.baseos}, + {'url': settings.repos.rhel8_os.appstream}, + {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], } @@ -797,10 +818,11 @@ def test_module_stream_actions_on_content_host( with session: session.location.select(default_location.name) # install Module Stream - result = session.host_new.apply_module_streams_action( + result = session.contenthost.execute_module_stream_action( vm_module_streams.hostname, - module_stream=FAKE_2_CUSTOM_PACKAGE_NAME, - action='Install', + action_type='Install', + module_name=FAKE_2_CUSTOM_PACKAGE_NAME, + stream_version=stream_version, ) assert result['overview']['hosts_table'][0]['Status'] == 'success' module_stream = session.contenthost.search_module_stream( @@ -886,10 +908,11 @@ def test_module_stream_actions_on_content_host( 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel8', 'YumRepository': [ - {'url': settings.repos.rhel10_os.baseos}, - {'url': settings.repos.rhel10_os.appstream}, + {'url': settings.repos.rhel8_os.baseos}, + {'url': settings.repos.rhel8_os.appstream}, + {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], } @@ -950,10 +973,11 @@ def test_module_streams_customize_action(session, default_location, vm_module_st 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel8', 'YumRepository': [ - {'url': settings.repos.rhel10_os.baseos}, - {'url': settings.repos.rhel10_os.appstream}, + {'url': settings.repos.rhel8_os.baseos}, + {'url': settings.repos.rhel8_os.appstream}, + {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], } @@ -1026,10 +1050,11 @@ def test_install_modular_errata(session, default_location, vm_module_streams): 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel8', 'YumRepository': [ - {'url': settings.repos.rhel10_os.baseos}, - {'url': settings.repos.rhel10_os.appstream}, + {'url': settings.repos.rhel8_os.baseos}, + {'url': settings.repos.rhel8_os.appstream}, + {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], } @@ -1090,10 +1115,10 @@ def test_module_status_update_from_content_host_to_satellite( 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel8', 'YumRepository': [ - {'url': settings.repos.rhel10_os.baseos}, - {'url': settings.repos.rhel10_os.appstream}, + {'url': settings.repos.rhel8_os.baseos}, + {'url': settings.repos.rhel8_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1174,10 +1199,10 @@ def test_module_status_update_without_force_upload_package_profile( 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel8', 'YumRepository': [ - {'url': settings.repos.rhel10_os.baseos}, - {'url': settings.repos.rhel10_os.appstream}, + {'url': settings.repos.rhel8_os.baseos}, + {'url': settings.repos.rhel8_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1249,10 +1274,10 @@ def test_module_stream_update_from_satellite(session, default_location, vm_modul 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel8', 'YumRepository': [ - {'url': settings.repos.rhel10_os.baseos}, - {'url': settings.repos.rhel10_os.appstream}, + {'url': settings.repos.rhel8_os.baseos}, + {'url': settings.repos.rhel8_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1290,10 +1315,10 @@ def test_syspurpose_attributes_empty(session, default_location, vm_module_stream 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel8', 'YumRepository': [ - {'url': settings.repos.rhel10_os.baseos}, - {'url': settings.repos.rhel10_os.appstream}, + {'url': settings.repos.rhel8_os.baseos}, + {'url': settings.repos.rhel8_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1334,10 +1359,10 @@ def test_set_syspurpose_attributes_cli(session, default_location, vm_module_stre 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel8', 'YumRepository': [ - {'url': settings.repos.rhel10_os.baseos}, - {'url': settings.repos.rhel10_os.appstream}, + {'url': settings.repos.rhel8_os.baseos}, + {'url': settings.repos.rhel8_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1382,7 +1407,9 @@ def test_unset_syspurpose_attributes_cli(session, default_location, vm_module_st 'module_repos_collection_with_manifest', [ { - 'distro': CHOST_RHEL_VER, + 'distro': 'rhel7', + 'RHELAnsibleEngineRepository': {'cdn': True}, + 'SatelliteToolsRepository': {}, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url},