From 9e8b42a7f99a579cbcfe81e6e448447406d45a60 Mon Sep 17 00:00:00 2001 From: shwsingh Date: Tue, 9 Apr 2024 19:53:32 +0530 Subject: [PATCH] Mark UI tests as end-to-end for Rocket Team Components --- tests/foreman/ui/test_computeprofiles.py | 1 + tests/foreman/ui/test_computeresource.py | 22 +++---- .../ui/test_computeresource_azurerm.py | 62 +++++++++---------- tests/foreman/ui/test_computeresource_ec2.py | 5 +- tests/foreman/ui/test_computeresource_gce.py | 53 ++++++++-------- .../ui/test_computeresource_libvirt.py | 6 +- 6 files changed, 72 insertions(+), 77 deletions(-) diff --git a/tests/foreman/ui/test_computeprofiles.py b/tests/foreman/ui/test_computeprofiles.py index 035e09a9938..cdf6842516f 100644 --- a/tests/foreman/ui/test_computeprofiles.py +++ b/tests/foreman/ui/test_computeprofiles.py @@ -15,6 +15,7 @@ import pytest +@pytest.mark.e2e @pytest.mark.tier2 @pytest.mark.upgrade def test_positive_end_to_end(session, module_location, module_org, module_target_sat): diff --git a/tests/foreman/ui/test_computeresource.py b/tests/foreman/ui/test_computeresource.py index abbc088aa47..67c02806606 100644 --- a/tests/foreman/ui/test_computeresource.py +++ b/tests/foreman/ui/test_computeresource.py @@ -47,7 +47,7 @@ def rhev_data(): @pytest.mark.tier2 -def test_positive_end_to_end(session, rhev_data, module_org, module_location, module_target_sat): +def test_positive_end_to_end(session, rhev_data, module_target_sat): """Perform end to end testing for compute resource RHEV. :id: 3c079675-e5d3-490e-9b7e-1c2950f9965d @@ -215,10 +215,10 @@ def test_positive_resource_vm_power_management(session, rhev_data): wait_for( lambda: ( - session.browser.refresh(), - session.computeresource.vm_status(name, rhev_data['vm_name']), - )[1] - is not status, + session.browser.refresh(), + session.computeresource.vm_status(name, rhev_data['vm_name']), + )[1] + is not status, timeout=180, delay=1, ) @@ -288,7 +288,6 @@ def test_positive_VM_import(session, module_org, module_location, rhev_data, mod name = gen_string('alpha') with session: - session.computeresource.create( { 'name': name, @@ -361,8 +360,9 @@ def test_positive_update_organization(session, rhev_data, module_location, modul assert new_organization.name in resource_values['organizations']['resources']['assigned'] +@pytest.mark.e2e @pytest.mark.tier2 -def test_positive_image_end_to_end(session, rhev_data, module_location, target_sat): +def test_positive_image_end_to_end(session, rhev_data, target_sat): """Perform end to end testing for compute resource RHV component image. :id: 62a5c52f-dd15-45e7-8200-c64bb335474f @@ -410,13 +410,13 @@ def test_positive_image_end_to_end(session, rhev_data, module_location, target_s session.computeresource.update_image(cr_name, image_name, dict(name=new_image_name)) assert session.computeresource.search_images(cr_name, image_name)[0] != image_name assert ( - session.computeresource.search_images(cr_name, new_image_name)[0]['Name'] - == new_image_name + session.computeresource.search_images(cr_name, new_image_name)[0]['Name'] + == new_image_name ) session.computeresource.delete_image(cr_name, new_image_name) assert ( - session.computeresource.search_images(cr_name, new_image_name)[0]['Name'] - != new_image_name + session.computeresource.search_images(cr_name, new_image_name)[0]['Name'] + != new_image_name ) diff --git a/tests/foreman/ui/test_computeresource_azurerm.py b/tests/foreman/ui/test_computeresource_azurerm.py index 36228513ffa..a27c91c12cb 100644 --- a/tests/foreman/ui/test_computeresource_azurerm.py +++ b/tests/foreman/ui/test_computeresource_azurerm.py @@ -51,14 +51,14 @@ def module_azure_cp_attrs(module_azurerm_cr, module_azurerm_custom_finishimg, sa @pytest.fixture(scope='module') def module_azure_hg( - sat_azure, - module_azurerm_cr, - module_azure_cp_attrs, - sat_azure_default_architecture, - sat_azure_default_os, - sat_azure_org, - sat_azure_loc, - sat_azure_domain, + sat_azure, + module_azurerm_cr, + module_azure_cp_attrs, + sat_azure_default_architecture, + sat_azure_default_os, + sat_azure_org, + sat_azure_loc, + sat_azure_domain, ): """Create hostgroup""" @@ -73,18 +73,17 @@ def module_azure_hg( ).create() +@pytest.mark.e2e @pytest.mark.tier4 @pytest.mark.parametrize('sat_azure', ['sat'], indirect=True) def test_positive_end_to_end_azurerm_ft_host_provision( - session, - sat_azure, - azurermclient, - module_azurerm_custom_finishimg, - module_azurerm_cr, - sat_azure_domain, - sat_azure_org, - sat_azure_loc, - module_azure_hg, + sat_azure, + azurermclient, + module_azurerm_custom_finishimg, + sat_azure_domain, + sat_azure_org, + sat_azure_loc, + module_azure_hg, ): """Provision Host with hostgroup and Compute-profile using finish template on AzureRm compute resource @@ -120,8 +119,8 @@ def test_positive_end_to_end_azurerm_ft_host_provision( host_info = session.host.get_details(fqdn) assert 'Installed' in host_info['properties']['properties_table']['Build'] assert ( - host_info['properties']['properties_table']['Host group'] - == module_azure_hg.name + host_info['properties']['properties_table']['Host group'] + == module_azure_hg.name ) # AzureRm Cloud assertion @@ -156,16 +155,13 @@ def test_positive_end_to_end_azurerm_ft_host_provision( 'sat_azure', ['sat', 'puppet_sat'], indirect=True, ids=['satellite', 'puppet_enabled'] ) def test_positive_azurerm_host_provision_ud( - session, - sat_azure, - azurermclient, - module_azurerm_cloudimg, - module_azurerm_cr, - sat_azure_domain, - sat_azure_default_os, - sat_azure_org, - sat_azure_loc, - module_azure_hg, + sat_azure, + azurermclient, + module_azurerm_cloudimg, + sat_azure_domain, + sat_azure_org, + sat_azure_loc, + module_azure_hg, ): """Provision a Host with hostgroup and Compute-profile using cloud-init image on AzureRm compute resource @@ -189,7 +185,7 @@ def test_positive_azurerm_host_provision_ud( # Provision Host try: with sat_azure.skip_yum_update_during_provisioning( - template='Kickstart default user data' + template='Kickstart default user data' ): session.host.create( { @@ -202,11 +198,11 @@ def test_positive_azurerm_host_provision_ud( host_info = session.host.get_details(fqdn) assert ( - 'Pending installation' in host_info['properties']['properties_table']['Build'] + 'Pending installation' in host_info['properties']['properties_table']['Build'] ) assert ( - host_info['properties']['properties_table']['Host group'] - == module_azure_hg.name + host_info['properties']['properties_table']['Host group'] + == module_azure_hg.name ) # AzureRm Cloud assertion diff --git a/tests/foreman/ui/test_computeresource_ec2.py b/tests/foreman/ui/test_computeresource_ec2.py index 0d08685543c..b47f7d843f2 100644 --- a/tests/foreman/ui/test_computeresource_ec2.py +++ b/tests/foreman/ui/test_computeresource_ec2.py @@ -39,11 +39,12 @@ def module_ec2_settings(): ) +@pytest.mark.e2e @pytest.mark.tier2 @pytest.mark.skip_if_not_set('http_proxy') @pytest.mark.skip_if_open("BZ:2032530") def test_positive_default_end_to_end_with_custom_profile( - session, module_org, module_location, module_ec2_settings, module_target_sat + session, module_org, module_location, module_ec2_settings, module_target_sat ): """Create EC2 compute resource with default properties and apply it's basic functionality. @@ -135,7 +136,7 @@ def test_positive_default_end_to_end_with_custom_profile( new_cr_name, module_ec2_settings['region'], FOREMAN_PROVIDERS['ec2'] ) assert ( - cr_profile_values['provider_content']['managed_ip'] == module_ec2_settings['managed_ip'] + cr_profile_values['provider_content']['managed_ip'] == module_ec2_settings['managed_ip'] ) assert cr_profile_values['provider_content']['flavor'] == AWS_EC2_FLAVOR_T2_MICRO session.computeresource.delete(new_cr_name) diff --git a/tests/foreman/ui/test_computeresource_gce.py b/tests/foreman/ui/test_computeresource_gce.py index a25edb1da44..a45a598bd0c 100644 --- a/tests/foreman/ui/test_computeresource_gce.py +++ b/tests/foreman/ui/test_computeresource_gce.py @@ -28,11 +28,12 @@ ) +@pytest.mark.e2e @pytest.mark.tier2 @pytest.mark.upgrade @pytest.mark.skip_if_not_set('http_proxy', 'gce') def test_positive_default_end_to_end_with_custom_profile( - session, sat_gce_org, sat_gce_loc, gce_cert, sat_gce + sat_gce_org, sat_gce_loc, gce_cert, sat_gce ): """Create GCE compute resource with default properties and apply it's basic functionality. @@ -124,8 +125,8 @@ def test_positive_default_end_to_end_with_custom_profile( assert cr_profile_values['breadcrumb'] == f'Edit {COMPUTE_PROFILE_SMALL}' assert cr_profile_values['compute_profile'] == COMPUTE_PROFILE_SMALL assert ( - cr_profile_values['compute_resource'] - == f'{new_cr_name} ({settings.gce.zone}-{FOREMAN_PROVIDERS["google"]})' + cr_profile_values['compute_resource'] + == f'{new_cr_name} ({settings.gce.zone}-{FOREMAN_PROVIDERS["google"]})' ) assert cr_profile_values['provider_content']['machine_type'] == GCE_MACHINE_TYPE_DEFAULT assert cr_profile_values['provider_content']['network'] == GCE_NETWORK_DEFAULT @@ -139,21 +140,20 @@ def test_positive_default_end_to_end_with_custom_profile( assert not session.computeresource.search(new_cr_name) +@pytest.mark.e2e @pytest.mark.tier4 @pytest.mark.run_in_one_thread @pytest.mark.skip_if_not_set('gce') @pytest.mark.parametrize('sat_gce', ['sat', 'puppet_sat'], indirect=True) def test_positive_gce_provision_end_to_end( - session, - request, - sat_gce, - sat_gce_org, - sat_gce_loc, - sat_gce_default_os, - gce_domain, - gce_hostgroup_resource_image, - googleclient, - gce_setting_update, + request, + sat_gce, + sat_gce_org, + sat_gce_loc, + sat_gce_default_os, + gce_domain, + gce_hostgroup_resource_image, + googleclient, ): """Provision Host on GCE compute resource @@ -195,9 +195,9 @@ def _finalize(): ) wait_for( lambda: sat_gce.api.Host() - .search(query={'search': f'name={hostname}'})[0] - .build_status_label - != 'Pending installation', + .search(query={'search': f'name={hostname}'})[0] + .build_status_label + != 'Pending installation', timeout=600, delay=15, silent_failure=True, @@ -224,22 +224,21 @@ def _finalize(): assert gceapi_vm.is_stopping or gceapi_vm.is_stopped +@pytest.mark.e2e @pytest.mark.tier4 @pytest.mark.upgrade @pytest.mark.run_in_one_thread @pytest.mark.skip_if_not_set('gce') @pytest.mark.parametrize('sat_gce', ['sat', 'puppet_sat'], indirect=True) def test_positive_gce_cloudinit_provision_end_to_end( - session, - request, - sat_gce, - sat_gce_org, - sat_gce_loc, - sat_gce_default_os, - gce_domain, - gce_hostgroup_resource_image, - googleclient, - gce_setting_update, + request, + sat_gce, + sat_gce_org, + sat_gce_loc, + sat_gce_default_os, + gce_domain, + gce_hostgroup_resource_image, + googleclient, ): """Provision Host on GCE compute resource @@ -284,7 +283,7 @@ def _finalize(): host_info = session.host.get_details(hostname) assert session.host.search(hostname)[0]['Name'] == hostname assert ( - host_info['properties']['properties_table']['Build'] == 'Pending installation clear' + host_info['properties']['properties_table']['Build'] == 'Pending installation clear' ) # 1.2 GCE Backend Assertions gceapi_vm = googleclient.get_vm(gceapi_vmname) diff --git a/tests/foreman/ui/test_computeresource_libvirt.py b/tests/foreman/ui/test_computeresource_libvirt.py index 42477b8d46a..76e63a6e4fa 100644 --- a/tests/foreman/ui/test_computeresource_libvirt.py +++ b/tests/foreman/ui/test_computeresource_libvirt.py @@ -29,7 +29,6 @@ LIBVIRT_URL = LIBVIRT_RESOURCE_URL % settings.libvirt.libvirt_hostname - @pytest.mark.tier2 @pytest.mark.e2e def test_positive_end_to_end(session, module_target_sat, module_org, module_location): @@ -116,14 +115,13 @@ def test_positive_end_to_end(session, module_target_sat, module_org, module_loca session.computeresource.delete(new_cr_name) assert not session.computeresource.search(new_cr_name) - +@pytest.mark.e2e @pytest.mark.on_premises_provisioning @pytest.mark.tier4 @pytest.mark.rhel_ver_match('[^6]') @pytest.mark.parametrize('setting_update', ['destroy_vm_on_host_delete=True'], indirect=True) def test_positive_provision_end_to_end( request, - session, setting_update, module_sca_manifest_org, module_location, @@ -154,7 +152,7 @@ def test_positive_provision_end_to_end( location=[module_location], organization=[module_sca_manifest_org], ).create() - with session: + with sat.ui_session() as session: session.host.create( { 'host.name': hostname,