Skip to content

Commit 5f3bebf

Browse files
committed
cherrypick : Modifications in CLI and UI Libvirt CR to resolve key error
1 parent 3266e21 commit 5f3bebf

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

pytest_fixtures/component/provision_pxe.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def module_provisioning_sat(
149149
It calls a workflow using broker to set up the network and to run satellite-installer.
150150
It uses the artifacts from the workflow to create all the necessary Satellite entities
151151
that are later used by the tests.
152+
For IPv4, it clears DHCP leases and restarts dhcpd to ensure provisioning can obtain addresses.
152153
"""
153154
provisioning_type = getattr(request, 'param', '')
154155
sat = module_target_sat
@@ -210,6 +211,9 @@ def module_provisioning_sat(
210211
remote_execution_proxy=[module_provisioning_capsule.id],
211212
domain=[domain.id],
212213
).create()
214+
if sat.network_type == NetworkType.IPV4:
215+
assert sat.execute('cat /dev/null > /var/lib/dhcpd/dhcpd.leases').status == 0
216+
assert sat.execute('systemctl restart dhcpd').status == 0
213217
return Box(sat=sat, domain=domain, subnet=subnet, provisioning_type=provisioning_type)
214218

215219

tests/foreman/cli/test_computeresource_libvirt.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from robottelo.exceptions import CLIReturnCodeError
4141
from robottelo.hosts import ContentHost
4242
from robottelo.utils.datafactory import parametrized
43+
from robottelo.utils.issue_handlers import is_open
4344

4445
LIBVIRT_URL = LIBVIRT_RESOURCE_URL % settings.libvirt.libvirt_hostname
4546

@@ -371,7 +372,7 @@ def test_positive_update_console_password(libvirt_url, set_console_password, mod
371372
@pytest.mark.e2e
372373
@pytest.mark.on_premises_provisioning
373374
@pytest.mark.rhel_ver_match('[7]')
374-
@pytest.mark.parametrize('pxe_loader', ['uefi', 'secureboot'], indirect=True)
375+
@pytest.mark.parametrize('pxe_loader', ['bios', 'uefi', 'secureboot'], indirect=True)
375376
@pytest.mark.parametrize('setting_update', ['destroy_vm_on_host_delete=True'], indirect=True)
376377
def test_positive_provision_end_to_end(
377378
request,
@@ -406,6 +407,10 @@ def test_positive_provision_end_to_end(
406407
407408
:customerscenario: true
408409
"""
410+
# Skip test for UEFI and SecureBoot loaders
411+
if is_open('SAT-41340') and pxe_loader.vm_firmware in ['uefi', 'uefi_secure_boot']:
412+
pytest.skip(f"Test not supported for {pxe_loader.vm_firmware} firmware")
413+
409414
sat = module_libvirt_provisioning_sat.sat
410415
cr_name = gen_string('alpha')
411416
hostname = gen_string('alpha').lower()
@@ -450,10 +455,15 @@ def test_positive_provision_end_to_end(
450455
assert hostname in result.stdout
451456

452457
wait_for(
453-
lambda: sat.cli.Host.info({'name': hostname})['status']['build-status']
454-
!= 'Pending installation',
458+
lambda: (
459+
sat.cli.Host.info({'name': hostname})
460+
.get('status', {})
461+
.get('build-status', 'Pending installation')
462+
!= 'Pending installation'
463+
),
455464
timeout=1800,
456465
delay=30,
466+
handle_exception=True,
457467
)
458468
host_info = sat.cli.Host.info({'id': host['id']})
459469
assert host_info['status']['build-status'] == 'Installed'

tests/foreman/ui/test_computeresource_libvirt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ def test_positive_provision_end_to_end(
181181
)
182182
name = f'{hostname}.{module_libvirt_provisioning_sat.domain.name}'
183183
request.addfinalizer(lambda: sat.provisioning_cleanup(name))
184-
assert session.host.search(name)[0]['Name'] == name
184+
result = session.host_new.search(name)[0]
185+
assert result['Name'] == name
185186

186187
# Check on Libvirt, if VM exists
187188
result = sat.execute(

0 commit comments

Comments
 (0)