Skip to content

Commit

Permalink
Add check to validate if vTPM device is added to VM on VMware
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Talreja <[email protected]>
  • Loading branch information
Gauravtalreja1 committed Jan 29, 2025
1 parent d42ab4a commit 84028c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 9 additions & 3 deletions tests/foreman/api/test_computeresource_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions tests/foreman/ui/test_computeresource_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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': {
Expand All @@ -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}
)
Expand Down

0 comments on commit 84028c4

Please sign in to comment.