diff --git a/tests/foreman/api/test_errata.py b/tests/foreman/api/test_errata.py index bb545dda858..6f9e31316df 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -824,9 +824,25 @@ def test_apply_modular_errata_using_default_content_view( stream = '0' version = '20180704244205' - rhel8_contenthost.install_katello_ca(target_sat) + """rhel8_contenthost.install_katello_ca(target_sat) rhel8_contenthost.register_contenthost( module_entitlement_manifest_org.label, rhel8_module_ak.name + )""" + + # Associate custom repos with org, lce, ak: + target_sat.cli_factory.setup_org_for_a_custom_repo( + { + 'organization-id': module_entitlement_manifest_org.id, + 'lifecycle-environment-id': default_lce.id, + 'activationkey-id': rhel8_module_ak.id, + 'content-view-id': rhel8_custom_repo_cv.id, + } + ) + rhel8_contenthost.register( + activation_keys=rhel8_module_ak.name, + target=target_sat, + org=module_entitlement_manifest_org, + loc=None, ) assert rhel8_contenthost.subscribed host = rhel8_contenthost.nailgun_host @@ -834,7 +850,7 @@ def test_apply_modular_errata_using_default_content_view( # Assert no errata on host, no packages applicable or installable errata = _fetch_available_errata(module_entitlement_manifest_org, host, expected_amount=0) assert len(errata) == 0 - rhel8_contenthost.install_katello_host_tools() + # rhel8_contenthost.install_katello_host_tools() # Install older version of module stream to generate the errata result = rhel8_contenthost.execute( f'yum -y module install {module_name}:{stream}:{version}', diff --git a/tests/foreman/ui/test_contenthost.py b/tests/foreman/ui/test_contenthost.py index 9fe08e90b80..91eab0fce1b 100644 --- a/tests/foreman/ui/test_contenthost.py +++ b/tests/foreman/ui/test_contenthost.py @@ -103,28 +103,29 @@ def run_remote_command_on_content_host(command, vm_module_streams): def get_supported_rhel_versions(): - """Helper to get supported rhel versions for contenthost. - return: a list of integers""" + """Helper to get the supported base rhel versions for contenthost. + return: a list of integers + """ return [ ver for ver in settings.supportability.content_hosts.rhel.versions if isinstance(ver, int) ] -def get_rhel_lifecycle_support(current_version): +def get_rhel_lifecycle_support(rhel_version): """Helper to get what the Lifecycle Support Status should be, based on provided rhel version. - :param current_version: integer of the current base rhel version - :return: the expected status of rhel version support, string""" - + :param rhel_version: integer of the current base rhel version + :return: string with the expected status of rhel version support + """ rhels = get_supported_rhel_versions() rhel_lifecycle_status = 'Unknown' - if current_version not in rhels: + if rhel_version not in rhels: return rhel_lifecycle_status - elif (len(rhels) - 1) - rhels.index(current_version) <= 1: + elif (len(rhels) - 1) - rhels.index(rhel_version) <= 1: rhel_lifecycle_status = 'Full support' - elif (len(rhels) - 1) - rhels.index(current_version) == 2: + elif (len(rhels) - 1) - rhels.index(rhel_version) == 2: rhel_lifecycle_status = 'Approaching end of maintenance support' - elif (len(rhels) - 1) - rhels.index(current_version) >= 3: + elif (len(rhels) - 1) - rhels.index(rhel_version) >= 3: rhel_lifecycle_status = 'End of maintenance support' return rhel_lifecycle_status @@ -132,6 +133,7 @@ def get_rhel_lifecycle_support(current_version): @pytest.mark.e2e @pytest.mark.tier3 +@pytest.mark.parametrize('setting_update', ['new_hosts_page'], indirect=True) @pytest.mark.parametrize( 'module_repos_collection_with_manifest', [ @@ -147,7 +149,6 @@ def get_rhel_lifecycle_support(current_version): ], indirect=True, ) -@pytest.mark.parametrize('setting_update', ['new_hosts_page'], indirect=True) @pytest.mark.no_containers def test_positive_end_to_end( vm, @@ -176,7 +177,6 @@ def test_positive_end_to_end( host_rhel_version = None if _distro.startswith('rhel'): host_rhel_version = int(_distro[4:]) - rhel_status = get_rhel_lifecycle_support(host_rhel_version if not None else 0) result = vm.run(f'yum -y install {FAKE_1_CUSTOM_PACKAGE}') @@ -186,14 +186,13 @@ def test_positive_end_to_end( session.settings.update(f'name = {property_name}', 'Yes') session.location.select(default_location.name) session.organization.select(module_org.name) - # Use new_host UI, only check the details and host status + # Use new hosts UI, only check the details and host status host_details = session.host.get_details(vm.hostname, widget_names='properties') host_status = session.host_new.get_host_statuses(vm.hostname) + # Use old hosts UI for remainder session.settings.update(f'name = {property_name}', 'No') - assert rhel_status in host_status['RHEL lifecycle']['Status'] assert rhel_status in host_details['properties']['properties_table']['RHEL lifecycle'] - # TODO: Use UI in old 'All Hosts' page, add 'RHEL Lifecycle status' column, assert the status. # Ensure content host is searchable assert session.contenthost.search(vm.hostname)[0]['Name'] == vm.hostname chost = session.contenthost.read(