Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions tests/foreman/ui/test_computeresource_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def test_positive_provision_end_to_end(
vmwareclient,
target_sat,
module_provisioning_rhel_content,
get_vmware_storagepod_summary_string,
get_vmware_datastore_summary_string,
):
"""Assign Ansible role to a Hostgroup and verify ansible role execution job is scheduled after a host is provisioned

Expand All @@ -616,7 +616,17 @@ 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 8 (64 bit)'
storage_data = {'storage': {'disks': [{'storage_pod': get_vmware_storagepod_summary_string}]}}
storage_data = {
'storage': {
'controller': VMWARE_CONSTANTS['scsicontroller'],
'disks': [
{
'data_store': get_vmware_datastore_summary_string,
'thin_provision': True,
}
],
}
}
network_data = {
'network_interfaces': {
'nic_type': VMWARE_CONSTANTS['network_interface_name'],
Expand Down Expand Up @@ -662,7 +672,8 @@ def test_positive_provision_end_to_end(
request.addfinalizer(lambda: target_sat.provisioning_cleanup(host_fqdn))
wait_for(
lambda: session.host_new.get_host_statuses(host_fqdn)['Build']['Status']
!= 'Pending installation',
!= 'Pending installation'
and session.host_new.get_host_statuses(host_fqdn)['Execution']['Status'] != 'N/A',
Comment on lines 674 to +676
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (testing): The new wait condition may still allow Execution to be in a transient state like running or scheduled, so the flakiness risk remains.

Right now the condition only ensures Execution is not 'N/A', which likely just means "no job yet" and doesn’t guarantee the job has finished. The wait can still exit while Execution is running or scheduled, so the subsequent assert values['Execution']['Status'] == 'Last execution succeeded' remains flaky.

Can we instead wait for a terminal Execution state (e.g. Last execution succeeded/cancelled/failed) along with Build != 'Pending installation', so the test clearly waits for job completion before asserting the final status?

timeout=1800,
delay=30,
fail_func=session.browser.refresh,
Expand All @@ -671,8 +682,7 @@ def test_positive_provision_end_to_end(
)
values = session.host_new.get_host_statuses(host_fqdn)
assert values['Build']['Status'] == 'Installed'
if not is_open('SAT-34088'):
assert values['Execution']['Status'] == 'Last execution succeeded'
assert values['Execution']['Status'] == 'Last execution succeeded'

# Verify SecureBoot is enabled on host after provisioning is completed successfully
if pxe_loader.vm_firmware == 'uefi_secure_boot':
Expand All @@ -682,7 +692,6 @@ def test_positive_provision_end_to_end(
provisioning_host.wait_for_connection()
assert 'SecureBoot enabled' in provisioning_host.execute('mokutil --sb-state').stdout

if not is_open('SAT-34088'):
# Verify if assigned role is executed on the host, and correct host passwd is set
host = ContentHost(target_sat.api.Host().search(query={'host': host_name})[0].read().ip)
assert host.execute('yum list installed rubygem-foreman_scap_client').status == 0
# Verify if assigned role is executed on the host, and correct host passwd is set
host = ContentHost(target_sat.api.Host().search(query={'host': host_name})[0].read().ip)
assert host.execute('yum list installed foreman_scap_client_bash').status == 0
Loading