diff --git a/pytest_fixtures/component/provisioning_template.py b/pytest_fixtures/component/provisioning_template.py index 1546b10c9d..d12be29d39 100644 --- a/pytest_fixtures/component/provisioning_template.py +++ b/pytest_fixtures/component/provisioning_template.py @@ -91,11 +91,15 @@ def module_sync_kickstart_content( ) task_status = module_target_sat.api.ForemanTask(id=task['id']).poll() assert task_status['result'] == 'success' + rhel_xy = Version( - constants.REPOS['kickstart'][f'rhel{rhel_ver}']['version'] + constants.REPOS['kickstart'][f'rhel{rhel_ver}_bos_beta']['version'] + if rhel_ver == 10 # TODO: Remove beta repos once RHEL10 is GA + else constants.REPOS['kickstart'][f'rhel{rhel_ver}']['version'] if rhel_ver == 7 else constants.REPOS['kickstart'][f'rhel{rhel_ver}_bos']['version'] ) + o_systems = module_target_sat.api.OperatingSystem().search( query={'search': f'family=Redhat and major={rhel_xy.major} and minor={rhel_xy.minor}'} ) diff --git a/pytest_fixtures/core/contenthosts.py b/pytest_fixtures/core/contenthosts.py index b7742fdcd3..50579027fd 100644 --- a/pytest_fixtures/core/contenthosts.py +++ b/pytest_fixtures/core/contenthosts.py @@ -94,16 +94,30 @@ def rhel8_contenthost_module(request): yield host -@pytest.fixture(params=[{'rhel_version': 6}]) -def rhel6_contenthost(request): - """A function-level fixture that provides a rhel6 content host object""" +@pytest.fixture(params=[{'rhel_version': '9'}]) +def rhel9_contenthost(request): + """A 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': '9'}]) -def rhel9_contenthost(request): - """A fixture that provides a rhel9 content host object""" +@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 diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 0bed0ae4d5..b7af842d15 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -33,12 +33,13 @@ DISTRO_DEFAULT = 'rhel7' -DISTROS_SUPPORTED = ['rhel6', 'rhel7', 'rhel8', 'rhel9'] +DISTROS_SUPPORTED = ['rhel6', 'rhel7', 'rhel8', 'rhel9', 'rhel10'] DISTROS_MAJOR_VERSION = { 'rhel6': 6, 'rhel7': 7, 'rhel8': 8, 'rhel9': 9, + 'rhel10': 10, } MAJOR_VERSION_DISTRO = {value: key for key, value in DISTROS_MAJOR_VERSION.items()} @@ -896,6 +897,12 @@ 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', @@ -952,6 +959,10 @@ 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 @@ -1773,6 +1784,7 @@ 'dsrhel7': 'DISA STIG for Red Hat Enterprise Linux 7', 'dsrhel8': 'DISA STIG for Red Hat Enterprise Linux 8', 'dsrhel9': 'DISA STIG for Red Hat Enterprise Linux 9', + 'dsrhel10': 'DISA STIG for Red Hat Enterprise Linux 10', 'esp': 'Example Server Profile', 'rhccp': 'Red Hat Corporate Profile for Certified Cloud Providers (RH CCP)', 'firefox': 'Mozilla Firefox STIG', @@ -1785,6 +1797,7 @@ 'cbrhel7': 'PCI-DSS v3.2.1 Control Baseline for Red Hat Enterprise Linux 7', 'cbrhel8': 'PCI-DSS v3.2.1 Control Baseline for Red Hat Enterprise Linux 8', 'cbrhel9': 'PCI-DSS v4.0 Control Baseline for Red Hat Enterprise Linux 9', + 'cbrhel10': '', 'ppgpo': 'Protection Profile for General Purpose Operating Systems', 'acscee': 'Australian Cyber Security Centre (ACSC) Essential Eight', 'ospp7': 'OSPP - Protection Profile for General Purpose Operating Systems v4.2.1', diff --git a/tests/foreman/api/test_ansible.py b/tests/foreman/api/test_ansible.py index e69a9dddf2..e850e8477f 100644 --- a/tests/foreman/api/test_ansible.py +++ b/tests/foreman/api/test_ansible.py @@ -401,6 +401,7 @@ def test_positive_ansible_job_on_multiple_host( self, target_sat, module_org, + rhel10_contenthost, rhel9_contenthost, rhel8_contenthost, rhel7_contenthost, @@ -426,7 +427,7 @@ def test_positive_ansible_job_on_multiple_host( :BZ: 2167396, 2190464, 2184117 """ - hosts = [rhel9_contenthost, rhel8_contenthost, rhel7_contenthost] + hosts = [rhel10_contenthost, rhel9_contenthost, rhel8_contenthost, rhel7_contenthost] SELECTED_ROLE = 'RedHatInsights.insights-client' for host in hosts: result = host.register( @@ -465,16 +466,16 @@ def test_positive_ansible_job_on_multiple_host( ) target_sat.wait_for_tasks( f'resource_type = JobInvocation and resource_id = {job["id"]}', - poll_timeout=1000, + poll_timeout=1500, must_succeed=False, ) result = target_sat.api.JobInvocation(id=job['id']).read() - assert result.succeeded == 2 # SELECTED_ROLE working on rhel8/rhel9 clients + assert result.succeeded == len(hosts) - 1 # SELECTED_ROLE working on rhel8/9/10 clients assert result.failed == 1 # SELECTED_ROLE failing on rhel7 client assert result.status_label == 'failed' @pytest.mark.no_containers - @pytest.mark.rhel_ver_match('[^6]') + @pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') # all major versions, excluding fips def test_positive_ansible_localhost_job_on_host( self, target_sat, module_org, module_location, module_ak_with_synced_repo, rhel_contenthost ): diff --git a/tests/foreman/api/test_capsulecontent.py b/tests/foreman/api/test_capsulecontent.py index 8968565901..2cab341f0e 100644 --- a/tests/foreman/api/test_capsulecontent.py +++ b/tests/foreman/api/test_capsulecontent.py @@ -804,7 +804,7 @@ def test_flatpak_pulpcore_endpoint(self, target_sat, module_capsule_configured): @pytest.mark.e2e @pytest.mark.tier4 @pytest.mark.skip_if_not_set('capsule') - @pytest.mark.parametrize('distro', ['rhel7', 'rhel8_bos', 'rhel9_bos']) + @pytest.mark.parametrize('distro', ['rhel7', 'rhel8_bos', 'rhel9_bos', 'rhel10_bos_beta']) def test_positive_sync_kickstart_repo( self, target_sat, module_capsule_configured, function_sca_manifest_org, distro ): @@ -868,18 +868,18 @@ def test_positive_sync_kickstart_repo( module_capsule_configured.wait_for_sync(start_time=timestamp) cvv = cvv.read() assert len(cvv.environment) == 2 - # Check for kickstart content on SAT and CAPS tail = ( f'rhel/server/7/{REPOS["kickstart"][distro]["version"]}/x86_64/kickstart' if distro == 'rhel7' + else f'{distro.split("_")[0]}/{REPOS["kickstart"][distro]["version"]}/beta/x86_64/baseos/kickstart' + if 'beta' in distro # for future beta rhel distros else f'{distro.split("_")[0]}/{REPOS["kickstart"][distro]["version"]}/x86_64/baseos/kickstart' # noqa:E501 ) url_base = ( f'pulp/content/{function_sca_manifest_org.label}/{lce.label}/{cv.label}/' f'content/dist/{tail}' ) - # Check kickstart specific files for file in KICKSTART_CONTENT: sat_file = target_sat.checksum_by_url(f'{target_sat.url}/{url_base}/{file}') @@ -1447,7 +1447,7 @@ def test_positive_remove_capsule_orphans( 'repos_collection', [ { - 'distro': 'rhel9', + 'distro': 'rhel10', 'YumRepository': {'url': settings.repos.yum_0.url}, } ], diff --git a/tests/foreman/api/test_errata.py b/tests/foreman/api/test_errata.py index b4085a0e68..b75a1808a9 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -1008,7 +1008,7 @@ def test_positive_list_sorted_filtered(custom_repo, target_sat): @pytest.fixture(scope='module') -def setup_content_rhel8( +def setup_rhel_content( module_sca_manifest_org, rh_repo_module_manifest, activation_key, @@ -1017,7 +1017,7 @@ def setup_content_rhel8( module_target_sat, return_result=True, ): - """Setup content for rhel8 content host + """Setup content for rhel content host Using RH SAT-TOOLS RHEL8 for sat-tools, and FAKE_YUM_9 as custom-repo. Published to content-view and promoted to lifecycle-environment. @@ -1067,7 +1067,7 @@ def setup_content_rhel8( @pytest.mark.tier2 def test_positive_get_count_for_host( - setup_content_rhel8, activation_key, rhel8_contenthost, module_target_sat + setup_rhel_content, activation_key, rhel9_contenthost, module_target_sat ): """Available errata count when retrieving Host @@ -1092,50 +1092,51 @@ def test_positive_get_count_for_host( :CaseImportance: Medium """ - org = setup_content_rhel8['organization'] - custom_repo = setup_content_rhel8['rh_repo'] - rhel8_contenthost.create_custom_repos(**{f'{custom_repo.name}': custom_repo.url}) - result = rhel8_contenthost.register( + chost = rhel9_contenthost + org = setup_rhel_content['organization'] + custom_repo = setup_rhel_content['rh_repo'] + chost.create_custom_repos(**{f'{custom_repo.name}': custom_repo.url}) + result = chost.register( org=org, activation_keys=activation_key.name, target=module_target_sat, loc=None, ) - assert result.status == 0, ( - f'Failed to register the host - {rhel8_contenthost.hostname}: {result.stderr}' - ) - assert rhel8_contenthost.subscribed - rhel8_contenthost.execute(r'subscription-manager repos --enable \*') - host = rhel8_contenthost.nailgun_host.read() + assert result.status == 0, f'Failed to register the host - {chost.hostname}: {result.stderr}' + assert chost.subscribed + chost.execute(r'subscription-manager repos --enable \*') + host = chost.nailgun_host.read() + # No applicable errata to start - assert rhel8_contenthost.applicable_errata_count == 0 + assert chost.applicable_errata_count == 0 for errata in ('security', 'bugfix', 'enhancement'): _validate_errata_counts(host, errata_type=errata, expected_value=0) # One bugfix errata after installing outdated Kangaroo - result = rhel8_contenthost.execute(f'yum install -y {FAKE_9_YUM_OUTDATED_PACKAGES[7]}') + result = chost.execute(f'yum install -y {FAKE_9_YUM_OUTDATED_PACKAGES[7]}') assert result.status == 0, f'Failed to install package {FAKE_9_YUM_OUTDATED_PACKAGES[7]}' _validate_errata_counts(host, errata_type='bugfix', expected_value=1) # One enhancement errata after installing outdated Gorilla - result = rhel8_contenthost.execute(f'yum install -y {FAKE_9_YUM_OUTDATED_PACKAGES[3]}') + result = chost.execute(f'yum install -y {FAKE_9_YUM_OUTDATED_PACKAGES[3]}') assert result.status == 0, f'Failed to install package {FAKE_9_YUM_OUTDATED_PACKAGES[3]}' _validate_errata_counts(host, errata_type='enhancement', expected_value=1) # Install and check two outdated packages, with applicable security erratum # custom_repo outdated Walrus - result = rhel8_contenthost.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}') + result = chost.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}') 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 - result = rhel8_contenthost.execute(f'yum install -y {REAL_RHEL8_1_PACKAGE_FILENAME}') + # TODO: Use REAL_RHEL 9 or 10 Packages + '''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 rhel8_contenthost.applicable_errata_count == 4 + assert chost.applicable_errata_count == 4''' @pytest.mark.upgrade @pytest.mark.tier3 def test_positive_get_applicable_for_host( - setup_content_rhel8, activation_key, rhel8_contenthost, target_sat + setup_rhel_content, activation_key, rhel10_contenthost, target_sat ): """Get applicable errata ids for a host @@ -1159,44 +1160,43 @@ def test_positive_get_applicable_for_host( :CaseImportance: Medium """ - org = setup_content_rhel8['organization'] - custom_repo = setup_content_rhel8['rh_repo'] + org = setup_rhel_content['organization'] + custom_repo = setup_rhel_content['rh_repo'] + chost = rhel10_contenthost - rhel8_contenthost.create_custom_repos(**{f'{custom_repo.name}': custom_repo.url}) - result = rhel8_contenthost.register( + chost.create_custom_repos(**{f'{custom_repo.name}': custom_repo.url}) + result = chost.register( activation_keys=activation_key.name, target=target_sat, org=org, loc=None, ) - assert result.status == 0, ( - f'Failed to register the host - {rhel8_contenthost.hostname}: {result.stderr}' - ) - assert rhel8_contenthost.subscribed - rhel8_contenthost.execute(r'subscription-manager repos --enable \*') + assert result.status == 0, f'Failed to register the host - {chost.hostname}: {result.stderr}' + assert chost.subscribed + chost.execute(r'subscription-manager repos --enable \*') for errata in REPO_WITH_ERRATA['errata']: # Remove custom package if present, old or new. package_name = errata['package_name'] - result = rhel8_contenthost.execute(f'yum erase -y {package_name}') + result = chost.execute(f'yum erase -y {package_name}') if result.status != 0: pytest.fail(f'Failed to remove {package_name}: {result.stdout} {result.stderr}') - rhel8_contenthost.execute('subscription-manager repos') - assert rhel8_contenthost.applicable_errata_count == 0 - host = rhel8_contenthost.nailgun_host.read() + chost.execute('subscription-manager repos') + assert chost.applicable_errata_count == 0 + host = chost.nailgun_host.read() # Check no applicable errata to start erratum = _fetch_available_errata(host, expected_amount=0) assert len(erratum) == 0 # Install outdated applicable custom package - rhel8_contenthost.run(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}') + chost.run(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}') erratum = _fetch_available_errata(host, 1) 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) - rhel8_contenthost.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 @@ -1260,7 +1260,7 @@ def test_positive_incremental_update_required( activation_key, module_cv, rh_repo_module_manifest, - rhel8_contenthost, + rhel9_contenthost, target_sat, ): """Given a set of hosts and errata, check for content view version @@ -1291,6 +1291,7 @@ def test_positive_incremental_update_required( :BZ: 2013093 """ + chost = rhel9_contenthost org = module_sca_manifest_org rh_repo = target_sat.api.Repository( id=rh_repo_module_manifest.id, @@ -1304,18 +1305,18 @@ def test_positive_incremental_update_required( _cv = cv_publish_promote(target_sat, org, module_cv, module_lce) module_cv = _cv['content-view'] - result = rhel8_contenthost.register( + result = chost.register( org=org, activation_keys=activation_key.name, target=target_sat, loc=None, ) - assert result.status == 0, f'Failed to register the host: {rhel8_contenthost.hostname}' - assert rhel8_contenthost.subscribed - rhel8_contenthost.execute(r'subscription-manager repos --enable \*') - host = rhel8_contenthost.nailgun_host.read() + assert result.status == 0, f'Failed to register the host: {chost.hostname}' + assert chost.subscribed + chost.execute(r'subscription-manager repos --enable \*') + host = chost.nailgun_host.read() # install package to create demand for an Erratum - result = rhel8_contenthost.run(f'yum install -y {REAL_RHEL8_1_PACKAGE_FILENAME}') + result = chost.run(f'yum install -y {REAL_RHEL8_1_PACKAGE_FILENAME}') assert result.status == 0, f'Failed to install package: {REAL_RHEL8_1_PACKAGE_FILENAME}' # Call nailgun to make the API POST to see if any incremental updates are required response = target_sat.api.Host().bulk_available_incremental_updates( @@ -1333,7 +1334,7 @@ def test_positive_incremental_update_required( ).create() module_cv = target_sat.api.ContentView(id=module_cv.id).read() module_cv = cv_publish_promote(target_sat, org, module_cv, module_lce)['content-view'] - rhel8_contenthost.execute('subscription-manager repos') + chost.execute('subscription-manager repos') # Call nailgun to make the API POST to ensure an incremental update is required response = target_sat.api.Host().bulk_available_incremental_updates( data={ @@ -1374,7 +1375,7 @@ def rh_repo_module_manifest(module_sca_manifest_org, module_target_sat): def test_positive_incremental_update_apply_to_envs_cvs( target_sat, module_sca_manifest_org, - rhel8_contenthost, + rhel10_contenthost, module_product, ): """With multiple environments and content views, register a host to one, @@ -1405,6 +1406,7 @@ def test_positive_incremental_update_apply_to_envs_cvs( incremental version of the content-view. """ + chost = rhel10_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 @@ -1475,21 +1477,21 @@ def test_positive_incremental_update_apply_to_envs_cvs( content_view=host_cv, ).create() # content host, global registration - result = rhel8_contenthost.register( + result = chost.register( org=module_sca_manifest_org, activation_keys=ak.name, target=target_sat, loc=None, ) - assert result.status == 0, f'Failed to register the host: {rhel8_contenthost.hostname}' - assert rhel8_contenthost.subscribed - rhel8_contenthost.execute(r'subscription-manager repos --enable \*') + assert result.status == 0, f'Failed to register the host: {chost.hostname}' + assert chost.subscribed + chost.execute(r'subscription-manager repos --enable \*') # Installing all outdated packages pkgs = ' '.join(FAKE_9_YUM_OUTDATED_PACKAGES) - assert rhel8_contenthost.execute(f'yum install -y {pkgs}').status == 0 - rhel8_contenthost.execute('subscription-manager repos') + assert chost.execute(f'yum install -y {pkgs}').status == 0 + chost.execute('subscription-manager repos') # After installing packages, check available incremental updates - host = rhel8_contenthost.nailgun_host.read() + host = chost.nailgun_host.read() response = target_sat.api.Host().bulk_available_incremental_updates( data={ 'organization_id': module_sca_manifest_org.id, @@ -1499,7 +1501,7 @@ def test_positive_incremental_update_apply_to_envs_cvs( ) # expecting no available updates before CV change assert response == [], ( - f'No incremental updates should currently be available to host: {rhel8_contenthost.hostname}.' + f'No incremental updates should currently be available to host: {chost.hostname}.' ) # New Erratum CV filter created for host view @@ -1515,11 +1517,11 @@ def test_positive_incremental_update_apply_to_envs_cvs( )['content-view-version'] # cv is not updated to host yet, applicable errata should be zero - rhel8_contenthost.execute('subscription-manager repos') - host_app_errata = rhel8_contenthost.applicable_errata_count + chost.execute('subscription-manager repos') + host_app_errata = chost.applicable_errata_count assert host_app_errata == 0 # After adding filter to cv, check available incremental updates - host_app_packages = rhel8_contenthost.applicable_package_count + host_app_packages = chost.applicable_package_count response = target_sat.api.Host().bulk_available_incremental_updates( data={ 'organization_id': module_sca_manifest_org.id, @@ -1527,12 +1529,10 @@ def test_positive_incremental_update_apply_to_envs_cvs( 'errata_ids': FAKE_9_YUM_SECURITY_ERRATUM, }, ) - assert response, ( - f'Expected one incremental update, but found none, for host: {rhel8_contenthost.hostname}.' - ) + assert response, f'Expected one incremental update, but found none, for host: {chost.hostname}.' # find that only expected CV version has incremental update available assert len(response) == 1, ( - f'Incremental update should currently be available to only one host: {rhel8_contenthost.hostname}.' + f'Incremental update should currently be available to only one host: {chost.hostname}.' ) next_version = float(response[0]['next_version']) assert float(host_cvv.version) + 0.1 == next_version # example: 2.0 > 2.1 @@ -1577,34 +1577,28 @@ def test_positive_incremental_update_apply_to_envs_cvs( assert host_version_number == next_version host_cvv = target_sat.api.ContentViewVersion(id=created_version_id).read() assert float(host_cvv.version) == next_version - rhel8_contenthost.execute('subscription-manager repos') + chost.execute('subscription-manager repos') # expected errata from FAKE_9 Security list added added_errata = response['output']['changed_content'][0]['added_units']['erratum'] assert set(added_errata) == set(FAKE_9_YUM_SECURITY_ERRATUM) # applicable errata count increased by length of security ids list - assert rhel8_contenthost.applicable_errata_count == host_app_errata + len( - FAKE_9_YUM_SECURITY_ERRATUM - ) + assert chost.applicable_errata_count == host_app_errata + len(FAKE_9_YUM_SECURITY_ERRATUM) # newly added errata from incremental version are now applicable to host - post_app_errata_ids = errata_id_set( - _fetch_available_errata_instances(target_sat, rhel8_contenthost) - ) + post_app_errata_ids = errata_id_set(_fetch_available_errata_instances(target_sat, chost)) assert set(FAKE_9_YUM_SECURITY_ERRATUM).issubset(post_app_errata_ids) # expected packages from the security erratum were added to host added_packages = response['output']['changed_content'][0]['added_units']['rpm'] assert len(added_packages) == 12 # expected that not all of the added packages will be applicable - assert 8 == host_app_packages == rhel8_contenthost.applicable_package_count + assert 8 == host_app_packages == chost.applicable_package_count # install all of the newly added packages, recalculate applicability for pkg in added_packages: - assert rhel8_contenthost.run(f'yum install -y {pkg}').status == 0 - rhel8_contenthost.execute('subscription-manager repos') + assert chost.run(f'yum install -y {pkg}').status == 0 + chost.execute('subscription-manager repos') # security errata should not be applicable after installing updated packages - post_app_errata_ids = errata_id_set( - _fetch_available_errata_instances(target_sat, rhel8_contenthost) - ) + post_app_errata_ids = errata_id_set(_fetch_available_errata_instances(target_sat, chost)) assert set(FAKE_9_YUM_SECURITY_ERRATUM).isdisjoint(post_app_errata_ids) - assert rhel8_contenthost.applicable_errata_count == 0 + assert chost.applicable_errata_count == 0 # after applying the incremental update, check for any more available response = target_sat.api.Host().bulk_available_incremental_updates( @@ -1616,5 +1610,5 @@ def test_positive_incremental_update_apply_to_envs_cvs( ) # expect no remaining updates, after applying the only one assert response == [], ( - f'No incremental updates should currently be available to host: {rhel8_contenthost.hostname}.' + f'No incremental updates should currently be available to host: {chost.hostname}.' ) diff --git a/tests/foreman/api/test_provisioning_puppet.py b/tests/foreman/api/test_provisioning_puppet.py index 1926469829..f1adf56ac6 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).*$') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') # all versions, excluding any 'fips' def test_host_provisioning_with_external_puppetserver( request, external_puppet_server, diff --git a/tests/foreman/destructive/test_capsule_loadbalancer.py b/tests/foreman/destructive/test_capsule_loadbalancer.py index 0cbb40484c..bfc0ed9b80 100644 --- a/tests/foreman/destructive/test_capsule_loadbalancer.py +++ b/tests/foreman/destructive/test_capsule_loadbalancer.py @@ -252,7 +252,7 @@ def test_loadbalancer_install_package( assert result.status == 0 -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match('N-2') @pytest.mark.tier1 def test_client_register_through_lb( loadbalancer_setup, diff --git a/tests/foreman/longrun/test_oscap.py b/tests/foreman/longrun/test_oscap.py index cdf4583aef..91f6fe6f25 100644 --- a/tests/foreman/longrun/test_oscap.py +++ b/tests/foreman/longrun/test_oscap.py @@ -37,7 +37,9 @@ 'rhel8': f'cv_{gen_string("alpha")}_rhel8', 'rhel7': f'cv_{gen_string("alpha")}_rhel7', } +# TODO: add rhel10 profile when available profiles = { + 'rhel10': OSCAP_PROFILE['dsrhel10'], 'rhel9': OSCAP_PROFILE['cbrhel9'], 'rhel8': OSCAP_PROFILE['ospp8'], 'rhel7': OSCAP_PROFILE['security7'], diff --git a/tests/foreman/ui/test_activationkey.py b/tests/foreman/ui/test_activationkey.py index 36b8ff5053..146d89881a 100644 --- a/tests/foreman/ui/test_activationkey.py +++ b/tests/foreman/ui/test_activationkey.py @@ -918,7 +918,7 @@ def test_negative_usage_limit(session, module_org, target_sat): @pytest.mark.no_containers -@pytest.mark.rhel_ver_match('^6') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') # all versions, excluding any 'fips' @pytest.mark.tier3 @pytest.mark.upgrade @pytest.mark.skipif((not settings.robottelo.repos_hosting_url), reason='Missing repos_hosting_url') diff --git a/tests/foreman/ui/test_contenthost.py b/tests/foreman/ui/test_contenthost.py index bc4134c70f..01a5a15d84 100644 --- a/tests/foreman/ui/test_contenthost.py +++ b/tests/foreman/ui/test_contenthost.py @@ -37,6 +37,8 @@ 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): @@ -63,20 +65,20 @@ def module_org(module_target_sat): @pytest.fixture -def vm(module_repos_collection_with_manifest, rhel7_contenthost, target_sat): +def vm(module_repos_collection_with_manifest, rhel10_contenthost, target_sat): """Virtual machine registered in satellite""" - 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 + 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 @pytest.fixture -def vm_module_streams(module_repos_collection_with_manifest, rhel8_contenthost, target_sat): +def vm_module_streams(module_repos_collection_with_manifest, rhel10_contenthost, target_sat): """Virtual machine registered in satellite""" - module_repos_collection_with_manifest.setup_virtual_machine(rhel8_contenthost) - rhel8_contenthost.add_rex_key(satellite=target_sat) - return rhel8_contenthost + module_repos_collection_with_manifest.setup_virtual_machine(rhel10_contenthost) + rhel10_contenthost.add_rex_key(satellite=target_sat) + return rhel10_contenthost def set_ignore_facts_for_os(module_target_sat, value=False): @@ -128,9 +130,7 @@ def get_rhel_lifecycle_support(rhel_version): 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, '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 rhel7 vm as a content host. Import repos + :setup: Register a rhel vm as a content host. Import repos collection and associated manifest. :steps: @@ -253,9 +253,7 @@ def test_positive_end_to_end( 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -338,9 +336,7 @@ def test_positive_end_to_end_bulk_update(session, default_location, vm, target_s 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -377,9 +373,7 @@ def test_negative_install_package(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -414,9 +408,7 @@ def test_positive_remove_package(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -452,9 +444,7 @@ def test_positive_upgrade_package(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -491,9 +481,7 @@ def test_positive_install_package_group(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -528,9 +516,7 @@ def test_positive_remove_package_group(session, default_location, vm): 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -572,9 +558,7 @@ def test_positive_search_errata_non_admin( 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -632,9 +616,7 @@ def test_positive_ensure_errata_applicability_with_host_reregistered(session, de 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -692,9 +674,7 @@ def test_positive_host_re_registration_with_host_rename( 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -783,11 +763,10 @@ def test_positive_check_ignore_facts_os_setting( 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel8', + 'distro': CHOST_RHEL_VER, 'YumRepository': [ - {'url': settings.repos.rhel8_os.baseos}, - {'url': settings.repos.rhel8_os.appstream}, - {'url': settings.repos.satutils_repo}, + {'url': settings.repos.rhel10_os.baseos}, + {'url': settings.repos.rhel10_os.appstream}, {'url': settings.repos.module_stream_1.url}, ], } @@ -818,11 +797,10 @@ def test_module_stream_actions_on_content_host( with session: session.location.select(default_location.name) # install Module Stream - result = session.contenthost.execute_module_stream_action( + result = session.host_new.apply_module_streams_action( vm_module_streams.hostname, - action_type='Install', - module_name=FAKE_2_CUSTOM_PACKAGE_NAME, - stream_version=stream_version, + module_stream=FAKE_2_CUSTOM_PACKAGE_NAME, + action='Install', ) assert result['overview']['hosts_table'][0]['Status'] == 'success' module_stream = session.contenthost.search_module_stream( @@ -908,11 +886,10 @@ def test_module_stream_actions_on_content_host( 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel8', + 'distro': 'rhel10', 'YumRepository': [ - {'url': settings.repos.rhel8_os.baseos}, - {'url': settings.repos.rhel8_os.appstream}, - {'url': settings.repos.satutils_repo}, + {'url': settings.repos.rhel10_os.baseos}, + {'url': settings.repos.rhel10_os.appstream}, {'url': settings.repos.module_stream_1.url}, ], } @@ -973,11 +950,10 @@ def test_module_streams_customize_action(session, default_location, vm_module_st 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel8', + 'distro': 'rhel10', 'YumRepository': [ - {'url': settings.repos.rhel8_os.baseos}, - {'url': settings.repos.rhel8_os.appstream}, - {'url': settings.repos.satutils_repo}, + {'url': settings.repos.rhel10_os.baseos}, + {'url': settings.repos.rhel10_os.appstream}, {'url': settings.repos.module_stream_1.url}, ], } @@ -1050,11 +1026,10 @@ def test_install_modular_errata(session, default_location, vm_module_streams): 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel8', + 'distro': 'rhel10', 'YumRepository': [ - {'url': settings.repos.rhel8_os.baseos}, - {'url': settings.repos.rhel8_os.appstream}, - {'url': settings.repos.satutils_repo}, + {'url': settings.repos.rhel10_os.baseos}, + {'url': settings.repos.rhel10_os.appstream}, {'url': settings.repos.module_stream_1.url}, ], } @@ -1115,10 +1090,10 @@ def test_module_status_update_from_content_host_to_satellite( 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel8', + 'distro': CHOST_RHEL_VER, 'YumRepository': [ - {'url': settings.repos.rhel8_os.baseos}, - {'url': settings.repos.rhel8_os.appstream}, + {'url': settings.repos.rhel10_os.baseos}, + {'url': settings.repos.rhel10_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1199,10 +1174,10 @@ def test_module_status_update_without_force_upload_package_profile( 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel8', + 'distro': CHOST_RHEL_VER, 'YumRepository': [ - {'url': settings.repos.rhel8_os.baseos}, - {'url': settings.repos.rhel8_os.appstream}, + {'url': settings.repos.rhel10_os.baseos}, + {'url': settings.repos.rhel10_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1274,10 +1249,10 @@ def test_module_stream_update_from_satellite(session, default_location, vm_modul 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel8', + 'distro': CHOST_RHEL_VER, 'YumRepository': [ - {'url': settings.repos.rhel8_os.baseos}, - {'url': settings.repos.rhel8_os.appstream}, + {'url': settings.repos.rhel10_os.baseos}, + {'url': settings.repos.rhel10_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1315,10 +1290,10 @@ def test_syspurpose_attributes_empty(session, default_location, vm_module_stream 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel8', + 'distro': CHOST_RHEL_VER, 'YumRepository': [ - {'url': settings.repos.rhel8_os.baseos}, - {'url': settings.repos.rhel8_os.appstream}, + {'url': settings.repos.rhel10_os.baseos}, + {'url': settings.repos.rhel10_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1359,10 +1334,10 @@ def test_set_syspurpose_attributes_cli(session, default_location, vm_module_stre 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel8', + 'distro': CHOST_RHEL_VER, 'YumRepository': [ - {'url': settings.repos.rhel8_os.baseos}, - {'url': settings.repos.rhel8_os.appstream}, + {'url': settings.repos.rhel10_os.baseos}, + {'url': settings.repos.rhel10_os.appstream}, {'url': settings.repos.satutils_repo}, {'url': settings.repos.module_stream_1.url}, ], @@ -1407,9 +1382,7 @@ def test_unset_syspurpose_attributes_cli(session, default_location, vm_module_st 'module_repos_collection_with_manifest', [ { - 'distro': 'rhel7', - 'RHELAnsibleEngineRepository': {'cdn': True}, - 'SatelliteToolsRepository': {}, + 'distro': CHOST_RHEL_VER, 'YumRepository': [ {'url': settings.repos.yum_1.url}, {'url': settings.repos.yum_6.url}, @@ -1439,6 +1412,7 @@ def test_syspurpose_bulk_action(session, default_location, vm): session.location.select(default_location.name) session.contenthost.bulk_set_syspurpose([vm.hostname], syspurpose_attributes) details = session.contenthost.read(vm.hostname, widget_names='details')['details'] + result = vm.execute('subscription-manager repos') for key, val in syspurpose_attributes.items(): assert details[key] == val result = run_remote_command_on_content_host('syspurpose show', vm) diff --git a/tests/foreman/ui/test_reporttemplates.py b/tests/foreman/ui/test_reporttemplates.py index fbc5661518..d930a630de 100644 --- a/tests/foreman/ui/test_reporttemplates.py +++ b/tests/foreman/ui/test_reporttemplates.py @@ -534,7 +534,7 @@ def test_positive_generate_all_installed_packages_report( @pytest.mark.tier2 @pytest.mark.no_containers -@pytest.mark.rhel_ver_match('[^6]') +@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') # all versions, excluding any 'fips' def test_positive_installable_errata_with_user( session, target_sat, function_org, function_lce, function_location, rhel_contenthost ):