diff --git a/tests/conftest.py b/tests/conftest.py index 9e9b149e73..f6769fb2ba 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2179,7 +2179,7 @@ def vm_preference_for_test(namespace, common_vm_preference_param_dict): @pytest.fixture(scope="class") -def common_vm_preference_param_dict(request): +def common_vm_preference_param_dict(request, is_s390x_cluster): common_preference_dict = { "name": request.param["name"], "client": request.param.get("client"), @@ -2194,7 +2194,12 @@ def common_vm_preference_param_dict(request): } } if request.param.get("clock_preferred_timer"): - common_preference_dict.setdefault("clock", {})["preferredTimer"] = request.param["clock_preferred_timer"] + if is_s390x_cluster: + LOGGER.info( + "Skipping preferredTimer in VirtualMachinePreference: x86-specific timers not available on s390x" + ) + else: + common_preference_dict.setdefault("clock", {})["preferredTimer"] = request.param["clock_preferred_timer"] if request.param.get("cpu_topology"): common_preference_dict["cpu"] = {"preferredCPUTopology": request.param["cpu_topology"]} diff --git a/tests/global_config_s390x.py b/tests/global_config_s390x.py index 883d27f9da..f7ef99b72d 100644 --- a/tests/global_config_s390x.py +++ b/tests/global_config_s390x.py @@ -23,6 +23,8 @@ instance_type_fedora_os_list = [OS_FLAVOR_FEDORA] instance_type_centos_os_list = [CENTOS_STREAM9_PREFERENCE] +nic_models_matrix = ["virtio"] + for _dir in dir(): if not config: # noqa: F821 diff --git a/tests/infrastructure/instance_types/test_common_vm_preference.py b/tests/infrastructure/instance_types/test_common_vm_preference.py index 45ccd66bd3..17ffbb75b9 100644 --- a/tests/infrastructure/instance_types/test_common_vm_preference.py +++ b/tests/infrastructure/instance_types/test_common_vm_preference.py @@ -1,3 +1,8 @@ +from __future__ import annotations + +import logging +from typing import TYPE_CHECKING + import pytest from ocp_resources.virtual_machine_cluster_preference import ( VirtualMachineClusterPreference, @@ -8,6 +13,11 @@ from utilities.constants import VIRT_OPERATOR, Images from utilities.virt import VirtualMachineForTests, running_vm +if TYPE_CHECKING: + from kubernetes.dynamic import DynamicClient + +LOGGER = logging.getLogger(__name__) + pytestmark = [pytest.mark.post_upgrade, pytest.mark.sno] @@ -52,10 +62,19 @@ def start_vm_with_cluster_preference(client, preference_name, namespace_name): running_vm(vm=vm, wait_for_interfaces=False, check_ssh_connectivity=False) -def run_general_vm_preferences(client, namespace, preferences): +def _preference_requires_efi(client: DynamicClient, preference_name: str) -> bool: + """Check if a VirtualMachineClusterPreference requires EFI firmware.""" + preference = VirtualMachineClusterPreference(client=client, name=preference_name) + return bool(preference.instance.spec.get("firmware", {}).get("preferredEfi")) + + +def run_general_vm_preferences(client, namespace, preferences, is_s390x): for preference_name in preferences: # TODO remove arm64 skip when openshift-virtualization-tests support arm64 if all(suffix not in preference_name for suffix in ["virtio", "arm64"]): + if is_s390x and _preference_requires_efi(client=client, preference_name=preference_name): + LOGGER.info(f"Skipping preference {preference_name}: EFI/OVMF not available on s390x") + continue start_vm_with_cluster_preference( client=client, preference_name=preference_name, @@ -87,12 +106,13 @@ def test_common_preferences_vendor_labels(base_vm_cluster_preferences): @pytest.mark.tier3 class TestCommonVmPreference: @pytest.mark.polarion("CNV-9894") - def test_common_vm_preference_windows(self, unprivileged_client, namespace): + def test_common_vm_preference_windows(self, unprivileged_client, namespace, is_s390x_cluster): run_general_vm_preferences( client=unprivileged_client, namespace=namespace, # drop legacy preferences with pcihole preferences=[pref for pref in VM_PREFERENCES_LIST["windows"] if pref not in {"windows.2k3", "windows.xp"}], + is_s390x=is_s390x_cluster, ) @pytest.mark.parametrize( @@ -113,16 +133,22 @@ def test_common_vm_preference_windows(self, unprivileged_client, namespace): ], ) @pytest.mark.s390x - def test_common_vm_preference_linux(self, cluster_preferences, unprivileged_client, namespace): + def test_common_vm_preference_linux(self, cluster_preferences, unprivileged_client, namespace, is_s390x_cluster): run_general_vm_preferences( - client=unprivileged_client, namespace=namespace, preferences=VM_PREFERENCES_LIST[cluster_preferences] + client=unprivileged_client, + namespace=namespace, + preferences=VM_PREFERENCES_LIST[cluster_preferences], + is_s390x=is_s390x_cluster, ) @pytest.mark.special_infra @pytest.mark.polarion("CNV-10806") - def test_common_vm_preference_dpdk(self, unprivileged_client, namespace): + def test_common_vm_preference_dpdk(self, unprivileged_client, namespace, is_s390x_cluster): run_general_vm_preferences( - client=unprivileged_client, namespace=namespace, preferences=VM_PREFERENCES_LIST["network"] + client=unprivileged_client, + namespace=namespace, + preferences=VM_PREFERENCES_LIST["network"], + is_s390x=is_s390x_cluster, ) diff --git a/tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py b/tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py index 0ee408e690..ff435eedad 100644 --- a/tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py +++ b/tests/infrastructure/instance_types/test_vm_with_instance_and_pref.py @@ -155,7 +155,6 @@ def test_instance_pref_controller_revision( @pytest.mark.dependency(depends=["start_vm_with_instance_type_and_preference"]) @pytest.mark.polarion("CNV-9821") - @pytest.mark.s390x def test_validate_clock_values(self, rhel_vm_with_instance_type_and_preference): clock_dict = rhel_vm_with_instance_type_and_preference.vmi.instance.to_dict()["spec"]["domain"]["clock"] vmi_clock_values = [ diff --git a/tests/storage/cdi_clone/test_clone.py b/tests/storage/cdi_clone/test_clone.py index 4f8f4e901b..cd2415435d 100644 --- a/tests/storage/cdi_clone/test_clone.py +++ b/tests/storage/cdi_clone/test_clone.py @@ -78,7 +78,6 @@ def create_vm_from_clone_dv_template( ], indirect=True, ) -@pytest.mark.s390x def test_successful_clone_of_large_image( namespace, data_volume_multi_storage_scope_function,