From aec9ae8b28e9a91b82810e25caa895adbdf785d6 Mon Sep 17 00:00:00 2001 From: David Moore Date: Tue, 17 Dec 2024 11:34:16 -0500 Subject: [PATCH 1/3] rhel10 parametrized fixture chosts --- .../component/provisioning_template.py | 11 +- pytest_fixtures/core/contenthosts.py | 26 +- robottelo/constants/__init__.py | 15 +- tests/foreman/api/test_ansible.py | 5 +- tests/foreman/api/test_capsulecontent.py | 4 +- tests/foreman/api/test_errata.py | 278 +++++++++--------- tests/foreman/api/test_provisioning_puppet.py | 2 +- .../destructive/test_capsule_loadbalancer.py | 2 +- tests/foreman/longrun/test_oscap.py | 2 + tests/foreman/ui/test_activationkey.py | 2 +- tests/foreman/ui/test_contenthost.py | 136 ++++----- tests/foreman/ui/test_reporttemplates.py | 2 +- 12 files changed, 248 insertions(+), 237 deletions(-) diff --git a/pytest_fixtures/component/provisioning_template.py b/pytest_fixtures/component/provisioning_template.py index 1546b10c9d4..4b217cbb52b 100644 --- a/pytest_fixtures/component/provisioning_template.py +++ b/pytest_fixtures/component/provisioning_template.py @@ -91,11 +91,12 @@ 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'] - if rhel_ver == 7 - else constants.REPOS['kickstart'][f'rhel{rhel_ver}_bos']['version'] - ) + if rhel_ver == 10: # TODO: Remove beta repos once RHEL10 is GA + rhel_xy = Version(constants.REPOS['kickstart'][f'rhel{rhel_ver}_bos_beta']['version']) + elif rhel_ver == 7: + rhel_xy = Version(constants.REPOS['kickstart'][f'rhel{rhel_ver}']['version']) + else: + rhel_xy = Version(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 b7742fdcd3b..50579027fdd 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 0bed0ae4d57..61bce4f17d5 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 = '' 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 = '' # for rhel10 RH package +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 e69a9dddf26..72d3f056ffc 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( @@ -474,7 +475,7 @@ def test_positive_ansible_job_on_multiple_host( 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 89685659015..b50e56859f9 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 ): @@ -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 b4085a0e68f..6e6c9ce60ae 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -162,9 +162,9 @@ def _fetch_available_errata_instances(sat, host, expected_amount=None, timeout=1 _errata_dict = _fetch_available_errata(host.nailgun_host, expected_amount, timeout) _errata_ids = [errata['id'] for errata in _errata_dict] instances = [sat.api.Errata(id=_id).read() for _id in _errata_ids] - assert len(instances) == len(_errata_dict) == host.applicable_errata_count, ( - 'Length of errata instances list or api result differs from expected applicable count.' - ) + assert ( + len(instances) == len(_errata_dict) == host.applicable_errata_count + ), 'Length of errata instances list or api result differs from expected applicable count.' return instances @@ -244,9 +244,9 @@ def package_applicability_changed_as_expected( change_in_errata int: positive, negative, or zero changed_errata list[string]: of modified errata_ids """ - assert len(prior_applicable_errata_list) == prior_applicable_errata_count, ( - 'Length of "prior_applicable_errata_list" passed, must equal "prior_applicable_errata_count" passed.' - ) + assert ( + len(prior_applicable_errata_list) == prior_applicable_errata_count + ), 'Length of "prior_applicable_errata_list" passed, must equal "prior_applicable_errata_count" passed.' if len(prior_applicable_errata_list) != 0: try: prior_applicable_errata_list[0].read() @@ -259,9 +259,9 @@ def package_applicability_changed_as_expected( task = None epoch_timestamp = int(time() - 1) output = host.execute('subscription-manager repos') - assert output.status == 0, ( - f'Command "$subscription-manager repos" failed to execute on host: {host.hostname}' - ) + assert ( + output.status == 0 + ), f'Command "$subscription-manager repos" failed to execute on host: {host.hostname}' try: task = sat.api_factory.wait_for_errata_applicability_task( host_id=host.nailgun_host.id, @@ -281,9 +281,9 @@ def package_applicability_changed_as_expected( if prior_applicable_errata_count == host.applicable_errata_count: # Applicable errata count had no change. # we expect applicable errata id(s) from search also did not change. - assert prior_unique_errata_ids == app_unique_errata_ids, ( - 'Expected list of applicable erratum to remain the same.' - ) + assert ( + prior_unique_errata_ids == app_unique_errata_ids + ), 'Expected list of applicable erratum to remain the same.' if prior_applicable_package_count == host.applicable_package_count: # no applicable packages were modified return False @@ -293,9 +293,9 @@ def package_applicability_changed_as_expected( # we expect one or more errata id(s) from search to be added or removed. difference = abs(prior_applicable_errata_count - host.applicable_errata_count) # Check list of errata id(s) from search matches expected difference - assert len(app_unique_errata_ids) == prior_applicable_errata_count + difference, ( - 'Length of applicable errata found by search, does not match applicability count difference.' - ) + assert ( + len(app_unique_errata_ids) == prior_applicable_errata_count + difference + ), 'Length of applicable errata found by search, does not match applicability count difference.' # modifying package increased errata applicability count (outdated ver installed) if prior_applicable_errata_count < host.applicable_errata_count: # save the new errata(s) found, ones added since package modify @@ -384,12 +384,12 @@ def package_applicability_changed_as_expected( # already checked that applicable package count changed, # but found applicable erratum list should not change, # check the errata count and list remained the same. - assert host.applicable_errata_count == prior_applicable_errata_count, ( - 'Expected current applicable errata count, to equal prior applicable errata count.' - ) - assert len(current_applicable_errata) == prior_applicable_errata_count, ( - 'Expected current applicable errata list length, to equal to prior applicable count.' - ) + assert ( + host.applicable_errata_count == prior_applicable_errata_count + ), 'Expected current applicable errata count, to equal prior applicable errata count.' + assert ( + len(current_applicable_errata) == prior_applicable_errata_count + ), 'Expected current applicable errata list length, to equal to prior applicable count.' assert prior_unique_errata_ids == app_unique_errata_ids, ( f'Expected set of prior applicable errata_ids: {prior_unique_errata_ids},' f' to be equivalent to set of current applicable errata_ids: {app_unique_errata_ids}.' @@ -479,9 +479,9 @@ def cv_publish_promote(sat, org, cv, lce=None, needs_publish=True, force=False): 'content-view': sat.api.ContentView(id=cv.id).read(), 'content-view-version': sat.api.ContentViewVersion(id=cvv_id).read(), } - assert all(entry for entry in _result.values()), ( - f'One or more necessary components are missing: {_result}' - ) + assert all( + entry for entry in _result.values() + ), f'One or more necessary components are missing: {_result}' return _result @@ -502,7 +502,7 @@ def _publish_and_wait(sat, org, cv, search_rate=1, max_tries=10): ), ( f'Failed to publish the Content-View: {cv.id}, in time.' - f'Task: {task_id} failed, or timed out ({search_rate * max_tries}s).' + f'Task: {task_id} failed, or timed out ({search_rate*max_tries}s).' ), ) @@ -562,9 +562,9 @@ def test_positive_install_in_hc( target=target_sat, loc=None, ) - assert result.status == 0, ( - f'Failed to register the host - {client.hostname}: {result.stderr}' - ) + assert ( + result.status == 0 + ), f'Failed to register the host - {client.hostname}: {result.stderr}' client.add_rex_key(satellite=target_sat) assert client.subscribed client.run(r'subscription-manager repos --enable \*') @@ -607,9 +607,9 @@ def test_positive_install_in_hc( pre_errata_count, pre_package_count, ) - assert passed_checks is True, ( - f'The package: {FAKE_1_CUSTOM_PACKAGE}, was not applicable to any erratum present on host: {client.hostname}.' - ) + assert ( + passed_checks is True + ), f'The package: {FAKE_1_CUSTOM_PACKAGE}, was not applicable to any erratum present on host: {client.hostname}.' # Setup host collection using client ids host_collection = target_sat.api.HostCollection(organization=module_sca_manifest_org).create() host_ids = [client.nailgun_host.id for client in content_hosts] @@ -638,9 +638,9 @@ def test_positive_install_in_hc( ) for client in content_hosts: # No applicable errata after install on all clients - assert client.applicable_errata_count == 0, ( - f'A client in Host-Collection: {client.hostname}, had {client.applicable_errata_count} ' - ) + assert ( + client.applicable_errata_count == 0 + ), f'A client in Host-Collection: {client.hostname}, had {client.applicable_errata_count} ' 'applicable errata, expected 0.' # Updated package is present on all clients result = client.run(f'rpm -q {FAKE_2_CUSTOM_PACKAGE}') @@ -870,17 +870,17 @@ def test_positive_install_multiple_in_host( from_when=epoch_timestamp, ) # Host Applicable Errata count decreased by one - assert rhel_contenthost.applicable_errata_count == pre_errata_count - 1, ( - f'Host applicable errata did not decrease by one, after installation of {ERRATUM}' - ) + assert ( + rhel_contenthost.applicable_errata_count == pre_errata_count - 1 + ), f'Host applicable errata did not decrease by one, after installation of {ERRATUM}' # Applying this ERRATUM updated one or more of the erratum's listed packages found_updated_packages = [] for package in errata_packages: result = rhel_contenthost.run(f'rpm -q {package}') if result.status == 0: - assert package in FAKE_9_YUM_UPDATED_PACKAGES, ( - f'An unexpected package: "{package}", was updated by this errata: {ERRATUM}.' - ) + assert ( + package in FAKE_9_YUM_UPDATED_PACKAGES + ), f'An unexpected package: "{package}", was updated by this errata: {ERRATUM}.' if package in ERRATUM_instance.packages: found_updated_packages.append(package) @@ -900,21 +900,21 @@ def test_positive_install_multiple_in_host( # In case no ERRATUM in list are applicable: # Lack of any package or errata install will raise `AssertionError`. - assert len(installed_errata) > 0, ( - f'No applicable errata were found or installed from list: {FAKE_9_YUM_SECURITY_ERRATUM}.' - ) - assert len(updated_packages) > 0, ( - f'No applicable packages were found or installed from list: {FAKE_9_YUM_UPDATED_PACKAGES}.' - ) + assert ( + len(installed_errata) > 0 + ), f'No applicable errata were found or installed from list: {FAKE_9_YUM_SECURITY_ERRATUM}.' + assert ( + len(updated_packages) > 0 + ), f'No applicable packages were found or installed from list: {FAKE_9_YUM_UPDATED_PACKAGES}.' # Each expected erratum and packages installed only once pkg_set = set(updated_packages) errata_set = set(installed_errata) - assert len(pkg_set) == len(updated_packages), ( - f'Expect no repeat packages in install list: {updated_packages}.' - ) - assert len(errata_set) == len(installed_errata), ( - f'Expected no repeat errata in install list: {installed_errata}.' - ) + assert len(pkg_set) == len( + updated_packages + ), f'Expect no repeat packages in install list: {updated_packages}.' + assert len(errata_set) == len( + installed_errata + ), f'Expected no repeat errata in install list: {installed_errata}.' # Only the expected YUM_9 packages were installed assert set(updated_packages).issubset(set(FAKE_9_YUM_UPDATED_PACKAGES)) # Only the expected YUM_9 errata were updated @@ -925,18 +925,18 @@ def test_positive_install_multiple_in_host( f' but installed: {len(installed_errata)}.' ) # Check sets of installed errata id(s) strings, matches expected - assert set(installed_errata) == set(expected_errata_to_install), ( - 'Expected errata id(s) and installed errata id(s) are not the same.' - ) + assert set(installed_errata) == set( + expected_errata_to_install + ), 'Expected errata id(s) and installed errata id(s) are not the same.' # Check number of updated package version filename(s) matches expected assert len(updated_packages) == len(security_packages_to_install), ( f'Expected to install {len(security_packages_to_install)} packages from list: {FAKE_9_YUM_UPDATED_PACKAGES},' f' but installed {len(updated_packages)}.' ) # Check sets of installed package filename(s) strings, matches expected - assert set(updated_packages) == set(security_packages_to_install), ( - 'Expected package version filename(s) and installed package version filenam(s) are not the same.' - ) + assert ( + set(updated_packages) == set(security_packages_to_install) + ), 'Expected package version filename(s) and installed package version filenam(s) are not the same.' @pytest.mark.tier3 @@ -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. @@ -1059,15 +1059,15 @@ def setup_content_rhel8( 'rh_repo': rh_repo.read(), 'custom_repo': custom_repo.read(), } - assert all(entry for entry in _result.values()), ( - f'One or more necessary components are not present: {_result}' - ) + assert all( + entry for entry in _result.values() + ), f'One or more necessary components are not present: {_result}' return _result if return_result else None @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,53 @@ 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 +1162,45 @@ 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 +1264,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 +1295,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 +1309,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 +1338,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 +1379,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 +1410,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 +1481,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, @@ -1498,9 +1504,9 @@ 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}.' - ) + assert ( + response == [] + ), f'No incremental updates should currently be available to host: {chost.hostname}.' # New Erratum CV filter created for host view target_sat.api.ErratumContentViewFilter(content_view=host_cv, inclusion=True).create() @@ -1515,11 +1521,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,13 +1533,13 @@ 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}.' - ) + assert ( + len(response) == 1 + ), 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 assert response[0]['content_view_version']['id'] == host_cvv.id @@ -1577,34 +1583,34 @@ 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( + 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) + _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) + _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( @@ -1615,6 +1621,6 @@ 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}.' - ) + assert ( + response == [] + ), 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 19264698294..f1adf56ac68 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 0cbb40484c0..bfc0ed9b809 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 cdf4583aefd..91f6fe6f251 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 36b8ff50530..146d89881ab 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 bc4134c70fd..01a5a15d840 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 fbc56615183..d930a630de7 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 ): From 505b95c363076ed9a7ea558ee7b7afc8c99c5a3c Mon Sep 17 00:00:00 2001 From: David Moore Date: Wed, 15 Jan 2025 14:02:26 -0500 Subject: [PATCH 2/3] rhel10_bos_beta for fixture module_sync_kickstart_content --- tests/foreman/api/test_errata.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/tests/foreman/api/test_errata.py b/tests/foreman/api/test_errata.py index 6e6c9ce60ae..26f88c67991 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -1102,9 +1102,7 @@ def test_positive_get_count_for_host( target=module_target_sat, loc=None, ) - assert ( - result.status == 0 - ), f'Failed to register the host - {chost.hostname}: {result.stderr}' + 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() @@ -1127,7 +1125,7 @@ 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 + # 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) @@ -1173,9 +1171,7 @@ def test_positive_get_applicable_for_host( org=org, loc=None, ) - assert ( - result.status == 0 - ), f'Failed to register the host - {chost.hostname}: {result.stderr}' + 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']: @@ -1533,9 +1529,7 @@ 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: {chost.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 @@ -1588,13 +1582,9 @@ def test_positive_incremental_update_apply_to_envs_cvs( 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 chost.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, chost) - ) + 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'] @@ -1606,9 +1596,7 @@ def test_positive_incremental_update_apply_to_envs_cvs( 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, chost) - ) + 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 chost.applicable_errata_count == 0 From 45c606e0a5b8d022d83b918e1553d73d5e4e56dc Mon Sep 17 00:00:00 2001 From: David Moore Date: Thu, 16 Jan 2025 11:44:10 -0500 Subject: [PATCH 3/3] api fixes --- .../component/provisioning_template.py | 15 +- robottelo/constants/__init__.py | 4 +- tests/foreman/api/test_ansible.py | 4 +- tests/foreman/api/test_capsulecontent.py | 4 +- tests/foreman/api/test_errata.py | 140 +++++++++--------- 5 files changed, 85 insertions(+), 82 deletions(-) diff --git a/pytest_fixtures/component/provisioning_template.py b/pytest_fixtures/component/provisioning_template.py index 4b217cbb52b..d12be29d396 100644 --- a/pytest_fixtures/component/provisioning_template.py +++ b/pytest_fixtures/component/provisioning_template.py @@ -91,12 +91,15 @@ def module_sync_kickstart_content( ) task_status = module_target_sat.api.ForemanTask(id=task['id']).poll() assert task_status['result'] == 'success' - if rhel_ver == 10: # TODO: Remove beta repos once RHEL10 is GA - rhel_xy = Version(constants.REPOS['kickstart'][f'rhel{rhel_ver}_bos_beta']['version']) - elif rhel_ver == 7: - rhel_xy = Version(constants.REPOS['kickstart'][f'rhel{rhel_ver}']['version']) - else: - rhel_xy = Version(constants.REPOS['kickstart'][f'rhel{rhel_ver}_bos']['version']) + + rhel_xy = 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/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 61bce4f17d5..b7af842d157 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -902,7 +902,7 @@ REAL_RHEL9_2_PACKAGE_FILENAME = '' REAL_RHEL10_PACKAGE_NAME = '' REAL_RHEL10_1_PACKAGE_FILENAME = '' -REAL_RHEL10_2_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', @@ -961,7 +961,7 @@ 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 = '' # for rhel10 RH package +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 diff --git a/tests/foreman/api/test_ansible.py b/tests/foreman/api/test_ansible.py index 72d3f056ffc..e850e8477fa 100644 --- a/tests/foreman/api/test_ansible.py +++ b/tests/foreman/api/test_ansible.py @@ -466,11 +466,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=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' diff --git a/tests/foreman/api/test_capsulecontent.py b/tests/foreman/api/test_capsulecontent.py index b50e56859f9..2cab341f0e0 100644 --- a/tests/foreman/api/test_capsulecontent.py +++ b/tests/foreman/api/test_capsulecontent.py @@ -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}') diff --git a/tests/foreman/api/test_errata.py b/tests/foreman/api/test_errata.py index 26f88c67991..b75a1808a9c 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -162,9 +162,9 @@ def _fetch_available_errata_instances(sat, host, expected_amount=None, timeout=1 _errata_dict = _fetch_available_errata(host.nailgun_host, expected_amount, timeout) _errata_ids = [errata['id'] for errata in _errata_dict] instances = [sat.api.Errata(id=_id).read() for _id in _errata_ids] - assert ( - len(instances) == len(_errata_dict) == host.applicable_errata_count - ), 'Length of errata instances list or api result differs from expected applicable count.' + assert len(instances) == len(_errata_dict) == host.applicable_errata_count, ( + 'Length of errata instances list or api result differs from expected applicable count.' + ) return instances @@ -244,9 +244,9 @@ def package_applicability_changed_as_expected( change_in_errata int: positive, negative, or zero changed_errata list[string]: of modified errata_ids """ - assert ( - len(prior_applicable_errata_list) == prior_applicable_errata_count - ), 'Length of "prior_applicable_errata_list" passed, must equal "prior_applicable_errata_count" passed.' + assert len(prior_applicable_errata_list) == prior_applicable_errata_count, ( + 'Length of "prior_applicable_errata_list" passed, must equal "prior_applicable_errata_count" passed.' + ) if len(prior_applicable_errata_list) != 0: try: prior_applicable_errata_list[0].read() @@ -259,9 +259,9 @@ def package_applicability_changed_as_expected( task = None epoch_timestamp = int(time() - 1) output = host.execute('subscription-manager repos') - assert ( - output.status == 0 - ), f'Command "$subscription-manager repos" failed to execute on host: {host.hostname}' + assert output.status == 0, ( + f'Command "$subscription-manager repos" failed to execute on host: {host.hostname}' + ) try: task = sat.api_factory.wait_for_errata_applicability_task( host_id=host.nailgun_host.id, @@ -281,9 +281,9 @@ def package_applicability_changed_as_expected( if prior_applicable_errata_count == host.applicable_errata_count: # Applicable errata count had no change. # we expect applicable errata id(s) from search also did not change. - assert ( - prior_unique_errata_ids == app_unique_errata_ids - ), 'Expected list of applicable erratum to remain the same.' + assert prior_unique_errata_ids == app_unique_errata_ids, ( + 'Expected list of applicable erratum to remain the same.' + ) if prior_applicable_package_count == host.applicable_package_count: # no applicable packages were modified return False @@ -293,9 +293,9 @@ def package_applicability_changed_as_expected( # we expect one or more errata id(s) from search to be added or removed. difference = abs(prior_applicable_errata_count - host.applicable_errata_count) # Check list of errata id(s) from search matches expected difference - assert ( - len(app_unique_errata_ids) == prior_applicable_errata_count + difference - ), 'Length of applicable errata found by search, does not match applicability count difference.' + assert len(app_unique_errata_ids) == prior_applicable_errata_count + difference, ( + 'Length of applicable errata found by search, does not match applicability count difference.' + ) # modifying package increased errata applicability count (outdated ver installed) if prior_applicable_errata_count < host.applicable_errata_count: # save the new errata(s) found, ones added since package modify @@ -384,12 +384,12 @@ def package_applicability_changed_as_expected( # already checked that applicable package count changed, # but found applicable erratum list should not change, # check the errata count and list remained the same. - assert ( - host.applicable_errata_count == prior_applicable_errata_count - ), 'Expected current applicable errata count, to equal prior applicable errata count.' - assert ( - len(current_applicable_errata) == prior_applicable_errata_count - ), 'Expected current applicable errata list length, to equal to prior applicable count.' + assert host.applicable_errata_count == prior_applicable_errata_count, ( + 'Expected current applicable errata count, to equal prior applicable errata count.' + ) + assert len(current_applicable_errata) == prior_applicable_errata_count, ( + 'Expected current applicable errata list length, to equal to prior applicable count.' + ) assert prior_unique_errata_ids == app_unique_errata_ids, ( f'Expected set of prior applicable errata_ids: {prior_unique_errata_ids},' f' to be equivalent to set of current applicable errata_ids: {app_unique_errata_ids}.' @@ -479,9 +479,9 @@ def cv_publish_promote(sat, org, cv, lce=None, needs_publish=True, force=False): 'content-view': sat.api.ContentView(id=cv.id).read(), 'content-view-version': sat.api.ContentViewVersion(id=cvv_id).read(), } - assert all( - entry for entry in _result.values() - ), f'One or more necessary components are missing: {_result}' + assert all(entry for entry in _result.values()), ( + f'One or more necessary components are missing: {_result}' + ) return _result @@ -502,7 +502,7 @@ def _publish_and_wait(sat, org, cv, search_rate=1, max_tries=10): ), ( f'Failed to publish the Content-View: {cv.id}, in time.' - f'Task: {task_id} failed, or timed out ({search_rate*max_tries}s).' + f'Task: {task_id} failed, or timed out ({search_rate * max_tries}s).' ), ) @@ -562,9 +562,9 @@ def test_positive_install_in_hc( target=target_sat, loc=None, ) - assert ( - result.status == 0 - ), f'Failed to register the host - {client.hostname}: {result.stderr}' + assert result.status == 0, ( + f'Failed to register the host - {client.hostname}: {result.stderr}' + ) client.add_rex_key(satellite=target_sat) assert client.subscribed client.run(r'subscription-manager repos --enable \*') @@ -607,9 +607,9 @@ def test_positive_install_in_hc( pre_errata_count, pre_package_count, ) - assert ( - passed_checks is True - ), f'The package: {FAKE_1_CUSTOM_PACKAGE}, was not applicable to any erratum present on host: {client.hostname}.' + assert passed_checks is True, ( + f'The package: {FAKE_1_CUSTOM_PACKAGE}, was not applicable to any erratum present on host: {client.hostname}.' + ) # Setup host collection using client ids host_collection = target_sat.api.HostCollection(organization=module_sca_manifest_org).create() host_ids = [client.nailgun_host.id for client in content_hosts] @@ -638,9 +638,9 @@ def test_positive_install_in_hc( ) for client in content_hosts: # No applicable errata after install on all clients - assert ( - client.applicable_errata_count == 0 - ), f'A client in Host-Collection: {client.hostname}, had {client.applicable_errata_count} ' + assert client.applicable_errata_count == 0, ( + f'A client in Host-Collection: {client.hostname}, had {client.applicable_errata_count} ' + ) 'applicable errata, expected 0.' # Updated package is present on all clients result = client.run(f'rpm -q {FAKE_2_CUSTOM_PACKAGE}') @@ -870,17 +870,17 @@ def test_positive_install_multiple_in_host( from_when=epoch_timestamp, ) # Host Applicable Errata count decreased by one - assert ( - rhel_contenthost.applicable_errata_count == pre_errata_count - 1 - ), f'Host applicable errata did not decrease by one, after installation of {ERRATUM}' + assert rhel_contenthost.applicable_errata_count == pre_errata_count - 1, ( + f'Host applicable errata did not decrease by one, after installation of {ERRATUM}' + ) # Applying this ERRATUM updated one or more of the erratum's listed packages found_updated_packages = [] for package in errata_packages: result = rhel_contenthost.run(f'rpm -q {package}') if result.status == 0: - assert ( - package in FAKE_9_YUM_UPDATED_PACKAGES - ), f'An unexpected package: "{package}", was updated by this errata: {ERRATUM}.' + assert package in FAKE_9_YUM_UPDATED_PACKAGES, ( + f'An unexpected package: "{package}", was updated by this errata: {ERRATUM}.' + ) if package in ERRATUM_instance.packages: found_updated_packages.append(package) @@ -900,21 +900,21 @@ def test_positive_install_multiple_in_host( # In case no ERRATUM in list are applicable: # Lack of any package or errata install will raise `AssertionError`. - assert ( - len(installed_errata) > 0 - ), f'No applicable errata were found or installed from list: {FAKE_9_YUM_SECURITY_ERRATUM}.' - assert ( - len(updated_packages) > 0 - ), f'No applicable packages were found or installed from list: {FAKE_9_YUM_UPDATED_PACKAGES}.' + assert len(installed_errata) > 0, ( + f'No applicable errata were found or installed from list: {FAKE_9_YUM_SECURITY_ERRATUM}.' + ) + assert len(updated_packages) > 0, ( + f'No applicable packages were found or installed from list: {FAKE_9_YUM_UPDATED_PACKAGES}.' + ) # Each expected erratum and packages installed only once pkg_set = set(updated_packages) errata_set = set(installed_errata) - assert len(pkg_set) == len( - updated_packages - ), f'Expect no repeat packages in install list: {updated_packages}.' - assert len(errata_set) == len( - installed_errata - ), f'Expected no repeat errata in install list: {installed_errata}.' + assert len(pkg_set) == len(updated_packages), ( + f'Expect no repeat packages in install list: {updated_packages}.' + ) + assert len(errata_set) == len(installed_errata), ( + f'Expected no repeat errata in install list: {installed_errata}.' + ) # Only the expected YUM_9 packages were installed assert set(updated_packages).issubset(set(FAKE_9_YUM_UPDATED_PACKAGES)) # Only the expected YUM_9 errata were updated @@ -925,18 +925,18 @@ def test_positive_install_multiple_in_host( f' but installed: {len(installed_errata)}.' ) # Check sets of installed errata id(s) strings, matches expected - assert set(installed_errata) == set( - expected_errata_to_install - ), 'Expected errata id(s) and installed errata id(s) are not the same.' + assert set(installed_errata) == set(expected_errata_to_install), ( + 'Expected errata id(s) and installed errata id(s) are not the same.' + ) # Check number of updated package version filename(s) matches expected assert len(updated_packages) == len(security_packages_to_install), ( f'Expected to install {len(security_packages_to_install)} packages from list: {FAKE_9_YUM_UPDATED_PACKAGES},' f' but installed {len(updated_packages)}.' ) # Check sets of installed package filename(s) strings, matches expected - assert ( - set(updated_packages) == set(security_packages_to_install) - ), 'Expected package version filename(s) and installed package version filenam(s) are not the same.' + assert set(updated_packages) == set(security_packages_to_install), ( + 'Expected package version filename(s) and installed package version filenam(s) are not the same.' + ) @pytest.mark.tier3 @@ -1059,9 +1059,9 @@ def setup_rhel_content( 'rh_repo': rh_repo.read(), 'custom_repo': custom_repo.read(), } - assert all( - entry for entry in _result.values() - ), f'One or more necessary components are not present: {_result}' + assert all(entry for entry in _result.values()), ( + f'One or more necessary components are not present: {_result}' + ) return _result if return_result else None @@ -1500,9 +1500,9 @@ 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: {chost.hostname}.' + assert response == [], ( + f'No incremental updates should currently be available to host: {chost.hostname}.' + ) # New Erratum CV filter created for host view target_sat.api.ErratumContentViewFilter(content_view=host_cv, inclusion=True).create() @@ -1531,9 +1531,9 @@ def test_positive_incremental_update_apply_to_envs_cvs( ) 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: {chost.hostname}.' + assert len(response) == 1, ( + 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 assert response[0]['content_view_version']['id'] == host_cvv.id @@ -1609,6 +1609,6 @@ 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: {chost.hostname}.' + assert response == [], ( + f'No incremental updates should currently be available to host: {chost.hostname}.' + )