diff --git a/tests/foreman/api/test_computeresource_vmware.py b/tests/foreman/api/test_computeresource_vmware.py index b02228e69c4..32ca7ca9fb5 100644 --- a/tests/foreman/api/test_computeresource_vmware.py +++ b/tests/foreman/api/test_computeresource_vmware.py @@ -26,7 +26,7 @@ @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, @@ -34,6 +34,7 @@ def test_positive_provision_end_to_end( module_provisioning_sat, module_sca_manifest_org, module_location, + module_ssh_key_file, pxe_loader, module_vmware_cr, module_vmware_hostgroup, @@ -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. @@ -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': { @@ -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 diff --git a/tests/foreman/cli/test_computeresource_vmware.py b/tests/foreman/cli/test_computeresource_vmware.py index 199180f9eff..fe83a31e7e7 100644 --- a/tests/foreman/cli/test_computeresource_vmware.py +++ b/tests/foreman/cli/test_computeresource_vmware.py @@ -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, @@ -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}', diff --git a/tests/foreman/ui/test_computeresource_vmware.py b/tests/foreman/ui/test_computeresource_vmware.py index c643cfd76b9..51237df3a52 100644 --- a/tests/foreman/ui/test_computeresource_vmware.py +++ b/tests/foreman/ui/test_computeresource_vmware.py @@ -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, @@ -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 @@ -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} @@ -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