Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"]}
Expand Down
2 changes: 2 additions & 0 deletions tests/global_config_s390x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 32 additions & 6 deletions tests/infrastructure/instance_types/test_common_vm_preference.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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]


Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
1 change: 0 additions & 1 deletion tests/storage/cdi_clone/test_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down