Skip to content

Commit 39b11fe

Browse files
committed
drop assert_vm_xml_efi
Signed-off-by: akri3i <guptaakriti70@gmail.com>
1 parent 44e7b79 commit 39b11fe

File tree

6 files changed

+4
-42
lines changed

6 files changed

+4
-42
lines changed

tests/infrastructure/instance_types/supported_os/test_fedora_os.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from utilities.constants import PREFERENCE_STR, U1_MEDIUM_STR
1010
from utilities.virt import (
1111
assert_linux_efi,
12-
assert_vm_xml_efi,
1312
check_qemu_guest_agent_installed,
1413
check_vm_xml_smbios,
1514
running_vm,
@@ -79,15 +78,12 @@ def test_efi_secureboot_enabled_lockdown_state(self, golden_image_fedora_vm_with
7978
@pytest.mark.polarion("CNV-11834")
8079
def test_efi_secureboot_disabled_and_enabled(
8180
self,
82-
admin_client,
8381
golden_image_fedora_vm_with_instance_type,
8482
):
8583
vm = golden_image_fedora_vm_with_instance_type
8684

8785
def _update_and_verify_secure_boot(vm, secure_boot_value):
8886
update_vm_efi_spec_and_restart(vm=vm, spec={"secureBoot": secure_boot_value})
89-
# assert vm config at hypervisor level
90-
assert_vm_xml_efi(vm=vm, admin_client=admin_client, secure_boot_enabled=secure_boot_value)
9187
assert_linux_efi(vm=vm)
9288

9389
# Disable secureboot

tests/infrastructure/instance_types/supported_os/test_rhel_os.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from utilities.constants import PREFERENCE_STR, U1_MEDIUM_STR
1414
from utilities.virt import (
1515
assert_linux_efi,
16-
assert_vm_xml_efi,
1716
check_qemu_guest_agent_installed,
1817
check_vm_xml_smbios,
1918
migrate_vm_and_verify,
@@ -101,15 +100,12 @@ def test_efi_secureboot_enabled_lockdown_state(self, golden_image_rhel_vm_with_i
101100
@pytest.mark.polarion("CNV-11834")
102101
def test_efi_secureboot_disabled_and_enabled(
103102
self,
104-
admin_client,
105103
golden_image_rhel_vm_with_instance_type,
106104
):
107105
vm = golden_image_rhel_vm_with_instance_type
108106

109107
def _update_and_verify_secure_boot(vm, secure_boot_value):
110108
update_vm_efi_spec_and_restart(vm=vm, spec={"secureBoot": secure_boot_value})
111-
# assert vm config at hypervisor level
112-
assert_vm_xml_efi(vm=vm, admin_client=admin_client, secure_boot_enabled=secure_boot_value)
113109
assert_linux_efi(vm=vm)
114110

115111
# Disable secureboot

tests/virt/cluster/common_templates/fedora/test_fedora_os_support.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from utilities.infra import validate_os_info_vmi_vs_linux_os
2121
from utilities.virt import (
2222
assert_linux_efi,
23-
assert_vm_xml_efi,
2423
migrate_vm_and_verify,
2524
running_vm,
2625
validate_libvirt_persistent_domain,
@@ -132,8 +131,7 @@ def test_os_version(self, matrix_fedora_os_vm_from_template):
132131
@pytest.mark.sno
133132
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::start_vm"])
134133
@pytest.mark.polarion("CNV-9666")
135-
def test_efi_secureboot_enabled_by_default(self, admin_client, matrix_fedora_os_vm_from_template):
136-
assert_vm_xml_efi(vm=matrix_fedora_os_vm_from_template, admin_client=admin_client)
134+
def test_efi_secureboot_enabled_by_default(self, matrix_fedora_os_vm_from_template):
137135
assert_linux_efi(vm=matrix_fedora_os_vm_from_template)
138136

139137
@pytest.mark.sno

tests/virt/cluster/common_templates/rhel/test_rhel_os_support.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from utilities.infra import validate_os_info_vmi_vs_linux_os
1919
from utilities.virt import (
2020
assert_linux_efi,
21-
assert_vm_xml_efi,
2221
check_qemu_guest_agent_installed,
2322
check_vm_xml_smbios,
2423
migrate_vm_and_verify,
@@ -88,10 +87,9 @@ def test_os_version(self, matrix_rhel_os_vm_from_template):
8887
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::start_vm"])
8988
@pytest.mark.polarion("CNV-8712")
9089
@pytest.mark.usefixtures("xfail_on_rhel_version_below_rhel9")
91-
def test_efi_secureboot_enabled_by_default(self, admin_client, matrix_rhel_os_vm_from_template):
90+
def test_efi_secureboot_enabled_by_default(self, matrix_rhel_os_vm_from_template):
9291
"""Test CNV common templates EFI secureboot status"""
9392

94-
assert_vm_xml_efi(vm=matrix_rhel_os_vm_from_template, admin_client=admin_client)
9593
assert_linux_efi(vm=matrix_rhel_os_vm_from_template)
9694

9795
@pytest.mark.arm64
@@ -221,10 +219,9 @@ def test_vmi_guest_agent_info_after_guest_reboot(self, matrix_rhel_os_vm_from_te
221219
@pytest.mark.polarion("CNV-6951")
222220
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::start_vm"])
223221
@pytest.mark.usefixtures("xfail_on_rhel_version_below_rhel9")
224-
def test_efi_secureboot_disabled(self, admin_client, matrix_rhel_os_vm_from_template):
222+
def test_efi_secureboot_disabled(self, matrix_rhel_os_vm_from_template):
225223
vm = matrix_rhel_os_vm_from_template
226224
update_vm_efi_spec_and_restart(vm=vm, spec={"secureBoot": False})
227-
assert_vm_xml_efi(vm=vm, admin_client=admin_client, secure_boot_enabled=False)
228225
assert_linux_efi(vm=vm)
229226

230227
@pytest.mark.arm64

tests/virt/cluster/common_templates/windows/test_windows_os_support.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from utilities.guest_support import assert_windows_efi, check_vm_xml_hyperv, check_windows_vm_hvinfo
1818
from utilities.ssp import validate_os_info_vmi_vs_windows_os
1919
from utilities.virt import (
20-
assert_vm_xml_efi,
2120
check_vm_xml_smbios,
2221
migrate_vm_and_verify,
2322
running_vm,
@@ -58,10 +57,9 @@ def test_start_vm(self, matrix_windows_os_vm_from_template):
5857
@pytest.mark.sno
5958
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::start_vm"])
6059
@pytest.mark.polarion("CNV-8854")
61-
def test_efi_secureboot_enabled_by_default(self, admin_client, matrix_windows_os_vm_from_template):
60+
def test_efi_secureboot_enabled_by_default(self, matrix_windows_os_vm_from_template):
6261
"""Test CNV common templates EFI secureboot status"""
6362

64-
assert_vm_xml_efi(vm=matrix_windows_os_vm_from_template, admin_client=admin_client)
6563
assert_windows_efi(vm=matrix_windows_os_vm_from_template)
6664

6765
@pytest.mark.sno

utilities/virt.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,29 +2615,6 @@ def check_vm_xml_smbios(vm: VirtualMachineForTests, cm_values: Dict[str, str], a
26152615
assert all(results.values())
26162616

26172617

2618-
def assert_vm_xml_efi(
2619-
vm: VirtualMachineForTests, admin_client: DynamicClient, *, secure_boot_enabled: bool = True
2620-
) -> None:
2621-
LOGGER.info("Verify VM XML - EFI secureBoot values.")
2622-
xml_dict_os = vm.vmi.get_xml_dict(privileged_client=admin_client)["domain"]["os"]
2623-
ovmf_path = "/usr/share/OVMF"
2624-
efi_path = f"{ovmf_path}/OVMF_CODE.secboot.fd"
2625-
# efi vars path when secure boot is enabled: /usr/share/OVMF/OVMF_VARS.secboot.fd
2626-
# efi vars path when secure boot is disabled: /usr/share/OVMF/OVMF_VARS.fd
2627-
efi_vars_path = f"{ovmf_path}/OVMF_VARS.{'secboot.' if secure_boot_enabled else ''}fd"
2628-
vmi_xml_efi_path = xml_dict_os["loader"]["#text"]
2629-
vmi_xml_efi_vars_path = xml_dict_os["nvram"]["@template"]
2630-
vmi_xml_os_secure = xml_dict_os["loader"]["@secure"]
2631-
os_secure = "yes" if secure_boot_enabled else "no"
2632-
assert vmi_xml_efi_path == efi_path, f"EFIPath value {vmi_xml_efi_path} does not match expected {efi_path} value"
2633-
assert vmi_xml_os_secure == os_secure, (
2634-
f"EFI secure value {vmi_xml_os_secure} does not seem to be set as {os_secure}"
2635-
)
2636-
assert vmi_xml_efi_vars_path == efi_vars_path, (
2637-
f"EFIVarsPath value {vmi_xml_efi_vars_path} does not match expected {efi_vars_path} value"
2638-
)
2639-
2640-
26412618
def update_vm_efi_spec_and_restart(
26422619
vm: VirtualMachineForTests, spec: dict[str, Any] | None = None, wait_for_interfaces: bool = True
26432620
) -> None:

0 commit comments

Comments
 (0)