Skip to content

Commit

Permalink
Shuffled the RHEL versions for api, cli, and ui modules
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Talreja <[email protected]>
  • Loading branch information
Gauravtalreja1 committed Jan 9, 2025
1 parent 5957771 commit be6a7fc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
16 changes: 12 additions & 4 deletions tests/foreman/api/test_computeresource_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
@pytest.mark.parametrize('vmware', ['vmware7', 'vmware8'], indirect=True)
@pytest.mark.parametrize('pxe_loader', ['bios', 'uefi', 'secureboot'], indirect=True)
@pytest.mark.parametrize('provision_method', ['build', 'bootdisk'])
@pytest.mark.rhel_ver_match('[7]')
@pytest.mark.rhel_ver_list('[9, 10]')
def test_positive_provision_end_to_end(
request,
setting_update,
module_provisioning_rhel_content,
module_provisioning_sat,
module_sca_manifest_org,
module_location,
module_ssh_key_file,
pxe_loader,
module_vmware_cr,
module_vmware_hostgroup,
Expand All @@ -47,7 +48,6 @@ def test_positive_provision_end_to_end(
:id: 6985e7c0-d258-4fc4-833b-e680804b55e8
:steps:
1. Configure provisioning setup.
2. Create VMware CR
3. Configure host group setup.
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_positive_provision_end_to_end(
'firmware': pxe_loader.vm_firmware,
'cluster': settings.vmware.cluster,
'start': '1',
'guest_id': 'rhel7_64Guest',
'guest_id': 'rhel9_64Guest',
'scsi_controllers': [{'type': 'ParaVirtualSCSIController', 'key': 1001}],
'nvme_controllers': [{'type': 'VirtualNVMEController', 'key': 2001}],
'volumes_attributes': {
Expand Down Expand Up @@ -127,9 +127,17 @@ def test_positive_provision_end_to_end(

# Verify SecureBoot is enabled on host after provisioning is completed sucessfully
if pxe_loader.vm_firmware == 'uefi_secure_boot':
provisioning_host = ContentHost(host.ip)
provisioning_host = ContentHost(host.ip, auth=module_ssh_key_file)
# Wait for the host to be rebooted and SSH daemon to be started.
provisioning_host.wait_for_connection()
# Enable Root Login
if int(host.operatingsystem.read().major) >= 9:
assert (
provisioning_host.execute(
'echo -e "\nPermitRootLogin yes" >> /etc/ssh/sshd_config; systemctl restart sshd'
).status
== 0
)
assert 'SecureBoot enabled' in provisioning_host.execute('mokutil --sb-state').stdout


Expand Down
4 changes: 2 additions & 2 deletions tests/foreman/cli/test_computeresource_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_positive_vmware_cr_end_to_end(target_sat, module_org, module_location,
@pytest.mark.parametrize('vmware', ['vmware7', 'vmware8'], indirect=True)
@pytest.mark.parametrize('pxe_loader', ['bios', 'uefi', 'secureboot'], indirect=True)
@pytest.mark.parametrize('provision_method', ['build', 'bootdisk'])
@pytest.mark.rhel_ver_match('[8]')
@pytest.mark.rhel_ver_match('[7]')
@pytest.mark.tier3
def test_positive_provision_end_to_end(
request,
Expand Down Expand Up @@ -126,7 +126,7 @@ def test_positive_provision_end_to_end(
'compute-attributes': f'cluster={settings.vmware.cluster},'
f'path=/Datacenters/{settings.vmware.datacenter}/vm/,'
'scsi_controller_type=VirtualLsiLogicController,'
f'guest_id=rhel8_64Guest,firmware={pxe_loader.vm_firmware},'
f'guest_id=rhel7_64Guest,firmware={pxe_loader.vm_firmware},'
'cpus=1,memory_mb=6000, start=1',
'interface': f'compute_type=VirtualVmxnet3,'
f'compute_network=VLAN {settings.provisioning.vlan_id}',
Expand Down
15 changes: 2 additions & 13 deletions tests/foreman/ui/test_computeresource_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,11 @@ def test_positive_virt_card(session, target_sat, module_location, module_org, vm
@pytest.mark.parametrize('setting_update', ['destroy_vm_on_host_delete=True'], indirect=True)
@pytest.mark.parametrize('pxe_loader', ['bios', 'uefi', 'secureboot'], indirect=True)
@pytest.mark.parametrize('provision_method', ['build'])
@pytest.mark.rhel_ver_list('[9, 10]')
@pytest.mark.rhel_ver_match('[8]')
@pytest.mark.tier3
def test_positive_provision_end_to_end(
request,
module_sca_manifest_org,
module_location,
pxe_loader,
module_vmware_cr,
module_vmware_hostgroup,
Expand All @@ -572,7 +571,6 @@ def test_positive_provision_end_to_end(
vmwareclient,
target_sat,
module_provisioning_rhel_content,
module_ssh_key_file,
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 Down Expand Up @@ -606,7 +604,6 @@ def test_positive_provision_end_to_end(
}
with target_sat.ui_session() as session:
session.organization.select(module_sca_manifest_org.name)
session.location.select(module_location.name)
session.ansibleroles.import_all_roles()
session.hostgroup.assign_role_to_hostgroup(
module_vmware_hostgroup.name, {'ansible_roles.resources': SELECTED_ROLE}
Expand Down Expand Up @@ -652,17 +649,9 @@ def test_positive_provision_end_to_end(
# Verify SecureBoot is enabled on host after provisioning is completed sucessfully
if pxe_loader.vm_firmware == 'uefi_secure_boot':
host = target_sat.api.Host().search(query={'host': host_name})[0].read()
provisioning_host = ContentHost(host.ip, auth=module_ssh_key_file)
provisioning_host = ContentHost(host.ip)
# Wait for the host to be rebooted and SSH daemon to be started.
provisioning_host.wait_for_connection()
# Enable Root Login
if int(host.operatingsystem.read().major) >= 9:
assert (
provisioning_host.execute(
'echo -e "\nPermitRootLogin yes" >> /etc/ssh/sshd_config; systemctl restart sshd'
).status
== 0
)
assert 'SecureBoot enabled' in provisioning_host.execute('mokutil --sb-state').stdout

# Verify if assigned role is executed on the host, and correct host passwd is set
Expand Down

0 comments on commit be6a7fc

Please sign in to comment.