Skip to content
Open
Show file tree
Hide file tree
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
36 changes: 23 additions & 13 deletions tests/foreman/ui/test_computeresource_azurerm.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ def test_positive_end_to_end_azurerm_ft_host_provision(
'provider_content.operating_system.image': finishimg_image,
}
)

host_info = session.host.get_details(fqdn)
assert 'Installed' in host_info['properties']['properties_table']['Build']
host_info = session.host_new.get_host_statuses(fqdn)
assert 'Installed' in host_info['Build']['Status']
host_page = session.host_new.get_details(fqdn, widget_names='overview')
assert (
host_info['properties']['properties_table']['Host group']
host_page['overview']['details']['details']['host_group']
== module_azure_hg.name
)

Expand All @@ -130,13 +130,19 @@ def test_positive_end_to_end_azurerm_ft_host_provision(
assert azurecloud_vm
assert azurecloud_vm.is_running
assert azurecloud_vm.name == hostname.lower()
assert azurecloud_vm.ip == host_info['properties']['properties_table']['IP Address']
assert (
azurecloud_vm.ip
== host_page['overview']['details']['details'][
f'{settings.server.NETWORK_TYPE}_address'
]
)
assert azurecloud_vm.type == AZURERM_VM_SIZE_DEFAULT

# Host Delete
with sat_azure.api_factory.satellite_setting('destroy_vm_on_host_delete=True'):
session.host.delete(fqdn)
assert not session.host.search(fqdn)
session.host_new.delete(fqdn)

assert not session.host_new.search(fqdn)

# AzureRm Cloud assertion
assert not azurecloud_vm.exists
Expand Down Expand Up @@ -200,12 +206,11 @@ def test_positive_azurerm_host_provision_ud(
}
)

host_info = session.host.get_details(fqdn)
host_info = session.host_new.get_host_statuses(fqdn)
assert 'Pending installation' in host_info['Build']['Status']
host_page = session.host_new.get_details(fqdn, widget_names='overview')
assert (
'Pending installation' in host_info['properties']['properties_table']['Build']
)
assert (
host_info['properties']['properties_table']['Host group']
host_page['overview']['details']['details']['host_group']
== module_azure_hg.name
)

Expand All @@ -214,7 +219,12 @@ def test_positive_azurerm_host_provision_ud(
assert azurecloud_vm
assert azurecloud_vm.is_running
assert azurecloud_vm.name == hostname.lower()
assert azurecloud_vm.ip == host_info['properties']['properties_table']['IP Address']
assert (
azurecloud_vm.ip
== host_page['overview']['details']['details'][
f'{settings.server.NETWORK_TYPE}_address'
]
)
assert azurecloud_vm.type == AZURERM_VM_SIZE_DEFAULT

finally:
Expand Down
32 changes: 21 additions & 11 deletions tests/foreman/ui/test_computeresource_gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,26 @@ def _finalize():
)
# 1. Host Creation Assertions
# 1.1 UI based Assertions
host_info = session.host.get_details(hostname)
assert session.host.search(hostname)[0]['Name'] == hostname
assert host_info['properties']['properties_table']['Build'] == 'Installed clear'
host_info = session.host_new.get_host_statuses(hostname)
assert session.host_new.search(hostname)[0]['Name'] == hostname
assert host_info['Build']['Status'] == 'Installed'
# 1.2 GCE Backend Assertions
gceapi_vm = googleclient.get_vm(gceapi_vmname)
host_page = session.host_new.get_details(hostname, widget_names='overview')
assert gceapi_vm.is_running
assert gceapi_vm
assert gceapi_vm.name == gceapi_vmname
assert gceapi_vm.zone == settings.gce.zone
assert gceapi_vm.ip == host_info['properties']['properties_table']['IP Address']
assert (
gceapi_vm.ip
== host_page['overview']['details']['details'][
f'{settings.server.NETWORK_TYPE}_address'
]
)
assert 'g1-small' in gceapi_vm.raw['machineType'].split('/')[-1]
assert 'default' in gceapi_vm.raw['networkInterfaces'][0]['network'].split('/')[-1]
# 2. Host Deletion Assertions
session.host.delete(hostname)
session.host_new.delete(hostname)
assert not sat_gce.api.Host().search(query={'search': f'name="{hostname}"'})
# 2.2 GCE Backend Assertions
assert gceapi_vm.is_stopping or gceapi_vm.is_stopped
Expand Down Expand Up @@ -280,22 +286,26 @@ def _finalize():
)
# 1. Host Creation Assertions
# 1.1 UI based Assertions
host_info = session.host.get_details(hostname)
host_info = session.host_new.get_host_statuses(hostname)
assert session.host.search(hostname)[0]['Name'] == hostname
assert (
host_info['properties']['properties_table']['Build'] == 'Pending installation clear'
)
assert host_info['Build']['Status'] == 'Pending installation'
# 1.2 GCE Backend Assertions
gceapi_vm = googleclient.get_vm(gceapi_vmname)
host_page = session.host_new.get_details(hostname, widget_names='overview')
assert gceapi_vm
assert gceapi_vm.is_running
assert gceapi_vm.name == gceapi_vmname
assert gceapi_vm.zone == settings.gce.zone
assert gceapi_vm.ip == host_info['properties']['properties_table']['IP Address']
assert (
gceapi_vm.ip
== host_page['overview']['details']['details'][
f'{settings.server.NETWORK_TYPE}_address'
]
)
assert 'g1-small' in gceapi_vm.raw['machineType'].split('/')[-1]
assert 'default' in gceapi_vm.raw['networkInterfaces'][0]['network'].split('/')[-1]
# 2. Host Deletion Assertions
session.host.delete(hostname)
session.host_new.delete(hostname)
assert not sat_gce.api.Host().search(query={'search': f'name="{hostname}"'})
# 2.2 GCE Backend Assertions
assert gceapi_vm.is_stopping or gceapi_vm.is_stopped
4 changes: 2 additions & 2 deletions tests/foreman/ui/test_computeresource_libvirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_positive_provision_end_to_end(
)
name = f'{hostname}.{module_libvirt_provisioning_sat.domain.name}'
request.addfinalizer(lambda: sat.provisioning_cleanup(name))
assert session.host.search(name)[0]['Name'] == name
assert session.host_new.search(name)[0]['Name'] == name

# Check on Libvirt, if VM exists
result = sat.execute(
Expand Down Expand Up @@ -209,7 +209,7 @@ def test_positive_provision_end_to_end(
provisioning_host.wait_for_connection()
assert 'SecureBoot enabled' in provisioning_host.execute('mokutil --sb-state').stdout

session.host.delete(name)
session.host_new.delete(name)
assert not sat.api.Host().search(query={'search': f'name="{name}"'})


Expand Down
16 changes: 8 additions & 8 deletions tests/foreman/ui/test_discoveredhost.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,16 @@ def test_positive_update_name(
quick=False,
host_values={'host.name': new_name},
)
assert session.host.search(new_host_name)[0]['Name'] == new_host_name
values = session.host.get_details(new_host_name)
assert values['properties']['properties_table']['Status'] == 'OK'
assert session.host_new.search(new_host_name)[0]['Name'] == new_host_name
values = session.host_new.get_details(new_host_name)
assert values['overview']['host_status']['status'] == 'All statuses OK'
assert not session.discoveredhosts.search(f'name = {discovered_host_name}')


@pytest.mark.upgrade
@pytest.mark.on_premises_provisioning
@pytest.mark.parametrize('module_provisioning_sat', ['discovery'], indirect=True)
@pytest.mark.parametrize('pxe_loader', ['bios', 'uefi'], indirect=True)
@pytest.mark.parametrize('pxe_loader', ['bios'], indirect=True)
@pytest.mark.rhel_ver_match('9')
def test_positive_auto_provision_host_with_rule(
request,
Expand Down Expand Up @@ -346,11 +346,11 @@ def test_positive_auto_provision_host_with_rule(
session.organization.select(org_name=module_org.name)
session.location.select(loc_name=module_location.name)
session.discoveredhosts.apply_action('Auto Provision', [discovered_host_name])
assert session.host.search(host_name)[0]['Name'] == host_name
host_values = session.host.get_details(host_name)
assert host_values['properties']['properties_table']['Status'] == 'OK'
assert session.host_new.search(host_name)[0]['Name'] == host_name
host_values = session.host_new.get_details(host_name)
assert host_values['overview']['host_status']['status'] == 'All statuses OK'
assert (
host_values['properties']['properties_table']['Comment']
host_values['overview']['details']['details']['comment']
== f"Auto-discovered and provisioned via rule '{discovery_rule.name}'"
)
assert not session.discoveredhosts.search(f'name = {discovered_host_name}')
Expand Down