diff --git a/pytest_fixtures/component/provision_pxe.py b/pytest_fixtures/component/provision_pxe.py index 43184e6f323..8cef98f3dec 100644 --- a/pytest_fixtures/component/provision_pxe.py +++ b/pytest_fixtures/component/provision_pxe.py @@ -237,30 +237,6 @@ def provisioning_host(module_ssh_key_file, pxe_loader): prov_host.blank = getattr(prov_host, 'blank', False) -@pytest.fixture -def provision_multiple_hosts(module_ssh_key_file, pxe_loader, request): - """Fixture to check out two blank VMs""" - vlan_id = settings.provisioning.vlan_id - cd_iso = ( - "" # TODO: Make this an optional fixture parameter (update vm_firmware when adding this) - ) - with Broker( - workflow=settings.provisioning.provisioning_host_workflow, - host_class=ContentHost, - _count=getattr(request, 'param', 2), - target_vlan_id=vlan_id, - target_vm_firmware=pxe_loader.vm_firmware, - target_pxeless_image=cd_iso, - blank=True, - target_memory='6GiB', - auth=module_ssh_key_file, - ) as hosts: - yield hosts - - for prov_host in hosts: - prov_host.blank = getattr(prov_host, 'blank', False) - - @pytest.fixture def provisioning_hostgroup( module_provisioning_sat, diff --git a/tests/foreman/api/test_discoveredhost.py b/tests/foreman/api/test_discoveredhost.py index 31ad0b1d415..45cda857130 100644 --- a/tests/foreman/api/test_discoveredhost.py +++ b/tests/foreman/api/test_discoveredhost.py @@ -404,7 +404,7 @@ def test_positive_reboot_all_pxe_hosts( self, module_provisioning_rhel_content, module_discovery_sat, - provision_multiple_hosts, + provisioning_host, provisioning_hostgroup, pxe_loader, ): @@ -414,33 +414,32 @@ def test_positive_reboot_all_pxe_hosts( :parametrized: yes - :setup: Provisioning should be configured and hosts should be discovered via PXE boot. + :Setup: Provisioning should be configured and hosts should be discovered via PXE boot. :steps: PUT /api/v2/discovered_hosts/reboot_all :expectedresults: All discovered hosst should be rebooted successfully - :CaseImportance: Medium + :verifies: SAT-23279 - :BZ: 2264195 + :CaseImportance: Medium """ sat = module_discovery_sat.sat - for host in provision_multiple_hosts: - host.power_control(ensure=False) - mac = host._broker_args['provisioning_nic_mac_addr'] - wait_for( - lambda: sat.api.DiscoveredHost().search(query={'mac': mac}) != [], # noqa: B023 - timeout=1500, - delay=20, - ) - discovered_host = sat.api.DiscoveredHost().search(query={'mac': mac})[0] - discovered_host.hostgroup = provisioning_hostgroup - discovered_host.location = provisioning_hostgroup.location[0] - discovered_host.organization = provisioning_hostgroup.organization[0] - discovered_host.build = True - # Until BZ 2264195 is resolved, reboot_all is expected to fail - result = sat.api.DiscoveredHost().reboot_all() - assert 'Discovered hosts are rebooting now' in result['success_msg'] + provisioning_host.power_control(ensure=False) + mac = provisioning_host._broker_args['provisioning_nic_mac_addr'] + wait_for( + lambda: sat.api.DiscoveredHost().search(query={'mac': mac}) != [], + timeout=1500, + delay=20, + ) + + discovered_host = sat.api.DiscoveredHost().search(query={'mac': mac})[0] + discovered_host.hostgroup = provisioning_hostgroup + discovered_host.location = provisioning_hostgroup.location[0] + discovered_host.organization = provisioning_hostgroup.organization[0] + discovered_host.build = True + result = sat.api.DiscoveredHost(id=discovered_host.id).reboot_all() + assert 'Unable to perform reboot' not in result class TestFakeDiscoveryTests: