From 42ee3565162e2ca3b70964cccc4f27195ecb62be Mon Sep 17 00:00:00 2001 From: Gaurav Talreja Date: Mon, 27 Jan 2025 23:57:21 +0530 Subject: [PATCH] Add check to validate if vTPM device is added to VM on VMware Signed-off-by: Gaurav Talreja --- tests/foreman/api/test_computeresource_vmware.py | 12 +++++++++--- tests/foreman/ui/test_computeresource_vmware.py | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/foreman/api/test_computeresource_vmware.py b/tests/foreman/api/test_computeresource_vmware.py index 69b499c897a..fe158de6c7f 100644 --- a/tests/foreman/api/test_computeresource_vmware.py +++ b/tests/foreman/api/test_computeresource_vmware.py @@ -58,7 +58,7 @@ def test_positive_provision_end_to_end( :CaseImportance: Critical - :Verifies: SAT-18721, SAT-23558, SAT-25810 + :Verifies: SAT-18721, SAT-23558, SAT-25810, SAT-25339 :customerscenario: true @@ -128,9 +128,15 @@ def test_positive_provision_end_to_end( request.addfinalizer(lambda: sat.provisioning_cleanup(host.name)) assert host.name == f'{name}.{module_provisioning_sat.domain.name}' - # check if vm is created on vmware + # Check if VM is created on VMware assert vmwareclient.does_vm_exist(host.name) is True - # check the build status + + # Check if virtual TPM device is added to created VM (only for UEFI) + if pxe_loader.vm_firmware != 'bios': + vm = vmwareclient.get_vm(host.name) + assert 'VirtualTPM' in vm.get_virtual_device_type_names() + + # Check the build status wait_for( lambda: host.read().build_status_label != 'Pending installation', timeout=1500, diff --git a/tests/foreman/ui/test_computeresource_vmware.py b/tests/foreman/ui/test_computeresource_vmware.py index 51237df3a52..a23ca1b55ee 100644 --- a/tests/foreman/ui/test_computeresource_vmware.py +++ b/tests/foreman/ui/test_computeresource_vmware.py @@ -562,6 +562,7 @@ def test_positive_virt_card(session, target_sat, module_location, module_org, vm def test_positive_provision_end_to_end( request, module_sca_manifest_org, + module_location, pxe_loader, module_vmware_cr, module_vmware_hostgroup, @@ -594,7 +595,7 @@ def test_positive_provision_end_to_end( """ SELECTED_ROLE = 'theforeman.foreman_scap_client' host_name = gen_string('alpha').lower() - guest_os_names = 'Red Hat Enterprise Linux 9 (64 bit)' + guest_os_names = 'Red Hat Enterprise Linux 8 (64 bit)' storage_data = {'storage': {'disks': [{'data_store': get_vmware_datastore_summary_string}]}} network_data = { 'network_interfaces': { @@ -603,8 +604,10 @@ def test_positive_provision_end_to_end( } } with target_sat.ui_session() as session: - session.organization.select(module_sca_manifest_org.name) session.ansibleroles.import_all_roles() + assert session.ansibleroles.import_all_roles() == session.ansibleroles.imported_roles_count + session.location.select(module_location.name) + session.organization.select(module_sca_manifest_org.name) session.hostgroup.assign_role_to_hostgroup( module_vmware_hostgroup.name, {'ansible_roles.resources': SELECTED_ROLE} )