From bb2058a064ffbd9b4b6641a3040a72ade7831412 Mon Sep 17 00:00:00 2001 From: David Moore Date: Wed, 29 Nov 2023 21:56:20 -0500 Subject: [PATCH] Helpers for rhel version support --- tests/foreman/ui/test_contenthost.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/foreman/ui/test_contenthost.py b/tests/foreman/ui/test_contenthost.py index 9fe08e90b80..ff3e332fef8 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 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,11 +186,11 @@ 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.