Skip to content

Commit d4d6fe8

Browse files
committed
Addressed Review comments
1. Removed defining test params based per arch and moved them to place they are set ex: cpu_threads & machine_type 2. Removed skip in the code based on arch, rather added s390x marker to test Signed-off-by: chandramerla <Chandra.Merla@ibm.com>
1 parent b263a89 commit d4d6fe8

28 files changed

Lines changed: 110 additions & 162 deletions

tests/conftest.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
from timeout_sampler import TimeoutSampler
7171

7272
import utilities.hco
73-
from tests.utils import download_and_extract_tar, update_cluster_cpu_model
73+
from utilities.architecture import is_cluster_s390x
7474
from utilities.bitwarden import get_cnv_tests_secret_by_name
7575
from utilities.constants import (
7676
AAQ_NAMESPACE_LABEL,
@@ -107,7 +107,6 @@
107107
RHEL9_STR,
108108
RHEL_WITH_INSTANCETYPE_AND_PREFERENCE,
109109
RHSM_SECRET_NAME,
110-
S390X,
111110
SSP_CR_COMMON_TEMPLATES_LIST_KEY_NAME,
112111
TIMEOUT_3MIN,
113112
TIMEOUT_4MIN,
@@ -215,6 +214,9 @@
215214
wait_for_windows_vm,
216215
)
217216

217+
from .utils import download_and_extract_tar, update_cluster_cpu_model
218+
from .virt.constants import MachineTypesNames
219+
218220
LOGGER = logging.getLogger(__name__)
219221
HTTP_SECRET_NAME = "htpass-secret-for-cnv-tests"
220222
HTPASSWD_PROVIDER_DICT = {
@@ -2769,12 +2771,22 @@ def cluster_modern_cpu_model_scope_class(
27692771
wait_for_kv_stabilize(admin_client=admin_client, hco_namespace=hco_namespace)
27702772

27712773

2774+
@pytest.fixture(scope="session")
2775+
def is_s390x_cluster():
2776+
return is_cluster_s390x()
2777+
2778+
2779+
@pytest.fixture(scope="function")
2780+
def non_default_machine_type(is_s390x_cluster):
2781+
return MachineTypesNames.s390_ccw_virtio if is_s390x_cluster else MachineTypesNames.pc_q35_rhel7_6
2782+
2783+
27722784
@pytest.fixture(scope="module")
2773-
def machine_type_from_kubevirt_config(kubevirt_config_scope_module, nodes_cpu_architecture):
2785+
def machine_type_from_kubevirt_config(is_s390x_cluster, kubevirt_config_scope_module, nodes_cpu_architecture):
27742786
"""Extract machine type default from kubevirt CR."""
27752787
# Workaround for s390x (https://github.com/kubevirt/kubevirt/issues/14953), as machine type missing in config and
27762788
# hardcoded to s390_ccw_virtio in kubevirt code.
2777-
if nodes_cpu_architecture == S390X:
2789+
if is_s390x_cluster:
27782790
mc_type = "s390-ccw-virtio"
27792791
else:
27802792
mc_type = kubevirt_config_scope_module["architectureConfiguration"][nodes_cpu_architecture]["machineType"]

tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def update_cluster_cpu_model(admin_client, hco_namespace, hco_resource, cpu_mode
284284
hco_namespace=hco_namespace,
285285
path=["cpuModel"],
286286
value=cpu_model,
287-
timeout=120,
287+
timeout=30,
288288
)
289289
yield
290290

tests/virt/node/conftest.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
FOUR_GI_MEMORY,
1818
ONE_CPU_CORE,
1919
ONE_CPU_THREAD,
20-
S390X,
2120
TEN_GI_MEMORY,
2221
)
2322
from utilities.virt import (
@@ -56,7 +55,7 @@ def hotplugged_vm(
5655
unprivileged_client,
5756
golden_image_data_source_scope_class,
5857
modern_cpu_for_migration,
59-
nodes_cpu_architecture,
58+
is_s390x_cluster,
6059
):
6160
with VirtualMachineForTestsFromTemplate(
6261
name=request.param["vm_name"],
@@ -66,8 +65,8 @@ def hotplugged_vm(
6665
client=unprivileged_client,
6766
data_source=golden_image_data_source_scope_class,
6867
cpu_max_sockets=EIGHT_CPU_SOCKETS,
69-
# s390x doesn't support maxGuest as it doesn't support hotplug
70-
memory_max_guest=TEN_GI_MEMORY if nodes_cpu_architecture != S390X else None,
68+
# s390x doesn't support maxGuest as it doesn't support hotplug memory
69+
memory_max_guest=None if is_s390x_cluster else TEN_GI_MEMORY,
7170
cpu_sockets=FOUR_CPU_SOCKETS,
7271
cpu_threads=ONE_CPU_THREAD,
7372
cpu_cores=ONE_CPU_CORE,

tests/virt/node/cpu_sockets_threads/test_cpu_support_sockets_threads.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def check_vm_dumpxml(vm, cores=None, sockets=None, threads=None):
2121

2222

2323
@pytest.fixture()
24-
def vm_with_cpu_support(request, namespace, unprivileged_client):
24+
def vm_with_cpu_support(request, is_s390x_cluster, namespace, unprivileged_client):
2525
"""
2626
VM with CPU support (cores,sockets,threads)
2727
"""
@@ -31,7 +31,7 @@ def vm_with_cpu_support(request, namespace, unprivileged_client):
3131
namespace=namespace.name,
3232
cpu_cores=request.param["cores"],
3333
cpu_sockets=request.param["sockets"],
34-
cpu_threads=request.param["threads"],
34+
cpu_threads=1 if is_s390x_cluster else request.param["threads"],
3535
cpu_max_sockets=request.param["sockets"] or 1,
3636
body=fedora_vm_body(name=name),
3737
client=unprivileged_client,
@@ -45,37 +45,28 @@ def vm_with_cpu_support(request, namespace, unprivileged_client):
4545
[
4646
pytest.param(
4747
{"sockets": 2, "cores": 2, "threads": 2},
48-
marks=(pytest.mark.polarion("CNV-2820"), pytest.mark.gating, pytest.mark.conformance, pytest.mark.x86_64()),
48+
marks=(pytest.mark.polarion("CNV-2820"), pytest.mark.gating, pytest.mark.conformance),
4949
id="case1: 2 cores, 2 threads, 2 sockets",
5050
),
5151
pytest.param(
5252
{"sockets": None, "cores": 1, "threads": 2},
53-
marks=(pytest.mark.polarion("CNV-2823"), pytest.mark.x86_64()),
53+
marks=(pytest.mark.polarion("CNV-2823")),
5454
id="case2: 1 cores, 2 threads, no sockets",
5555
),
56-
pytest.param(
57-
{"sockets": 2, "cores": 2, "threads": 1},
58-
marks=(pytest.mark.gating(), pytest.mark.s390x()),
59-
id="case1: 2 cores, 1 threads, 2 sockets",
60-
),
61-
pytest.param(
62-
{"sockets": None, "cores": 1, "threads": 1},
63-
marks=[pytest.mark.s390x()],
64-
id="case2: 1 cores, 1 threads, no sockets",
65-
),
6656
pytest.param(
6757
{"sockets": 2, "cores": 1, "threads": None},
68-
marks=(pytest.mark.polarion("CNV-2822"), pytest.mark.x86_64(), pytest.mark.s390x()),
58+
marks=(pytest.mark.polarion("CNV-2822")),
6959
id="case3: 1 cores, no threads, 2 sockets",
7060
),
7161
pytest.param(
7262
{"sockets": None, "cores": 2, "threads": None},
73-
marks=(pytest.mark.polarion("CNV-2821"), pytest.mark.x86_64(), pytest.mark.s390x()),
63+
marks=(pytest.mark.polarion("CNV-2821")),
7464
id="case4: 2 cores, no threads, no sockets",
7565
),
7666
],
7767
indirect=True,
7868
)
69+
@pytest.mark.s390x
7970
def test_vm_with_cpu_support(vm_with_cpu_support):
8071
"""
8172
Test VM with cpu support
@@ -107,7 +98,6 @@ def no_cpu_settings_vm(namespace, unprivileged_client):
10798

10899
@pytest.mark.gating
109100
@pytest.mark.conformance
110-
@pytest.mark.x86_64
111101
@pytest.mark.s390x
112102
@pytest.mark.polarion("CNV-1485")
113103
def test_vm_with_no_cpu_settings(no_cpu_settings_vm):
@@ -120,7 +110,6 @@ def test_vm_with_no_cpu_settings(no_cpu_settings_vm):
120110

121111

122112
@pytest.mark.gating
123-
@pytest.mark.x86_64
124113
@pytest.mark.s390x
125114
@pytest.mark.polarion("CNV-2818")
126115
def test_vm_with_cpu_limitation(namespace, unprivileged_client):
@@ -144,7 +133,6 @@ def test_vm_with_cpu_limitation(namespace, unprivileged_client):
144133

145134

146135
@pytest.mark.polarion("CNV-2819")
147-
@pytest.mark.x86_64
148136
@pytest.mark.s390x
149137
def test_vm_with_cpu_limitation_negative(namespace, unprivileged_client):
150138
"""

tests/virt/node/efi_secureboot/test_vm_with_efi_secureboot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
@pytest.mark.gating
1616
@pytest.mark.polarion("CNV-4465")
17-
@pytest.mark.x86_64
1817
def test_efi_secureboot_with_smm_disabled(namespace, unprivileged_client):
1918
"""Test that EFI secureBoot VM with SMM disabled, does not get created"""
2019
with pytest.raises(UnprocessibleEntityError):

tests/virt/node/general/test_custom_selinux_policy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from utilities.infra import ExecCommandOnPod
44

55

6-
@pytest.mark.x86_64
76
@pytest.mark.s390x
87
@pytest.mark.polarion("CNV-9918")
98
def test_customselinuxpolicy(workers_utility_pods, schedulable_nodes):

tests/virt/node/general/test_disable_pvspinlock.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def vm_for_test_pvspinlock(
2020

2121

2222
@pytest.mark.polarion("CNV-6877")
23-
@pytest.mark.x86_64
2423
def test_disable_pvspinlock(vm_for_test_pvspinlock):
2524
assert vm_for_test_pvspinlock.privileged_vmi.xml_dict["domain"]["features"]["pvspinlock"]["@state"] == "off", (
2625
"pvspinlock is not disabled in domain xml."

tests/virt/node/general/test_disk_io_option.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def disk_options_vm(
6767

6868
@pytest.mark.gating
6969
@pytest.mark.s390x
70-
@pytest.mark.x86_64
7170
@pytest.mark.parametrize(
7271
"golden_image_data_volume_scope_class,",
7372
[
@@ -116,7 +115,6 @@ def test_vm_with_disk_io_option_rhel(
116115

117116

118117
@pytest.mark.tier3
119-
@pytest.mark.x86_64
120118
@pytest.mark.parametrize(
121119
"golden_image_data_volume_scope_class,",
122120
[

tests/virt/node/general/test_legacy_machinetype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def rhel_8_10_vm(unprivileged_client, namespace, rhel_8_10_ds):
8787
)
8888
],
8989
)
90-
@pytest.mark.x86_64 # no legacy machinetype for s390x which is different from emulated machine types
90+
# For s390x, there is no legacy machinetype which is different from emulated machine types
9191
def test_legacy_machine_type(
9292
updated_hco_emulated_machine_i440fx,
9393
rhel_8_10_vm,

tests/virt/node/general/test_linux_label.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ def assert_linux_label_was_added_in_nodes(nodes):
1717
@pytest.mark.gating
1818
@pytest.mark.conformance
1919
@pytest.mark.s390x
20-
@pytest.mark.x86_64
2120
@pytest.mark.polarion("CNV-5758")
2221
def test_linux_label_was_added(schedulable_nodes):
2322
assert_linux_label_was_added_in_nodes(nodes=schedulable_nodes)

0 commit comments

Comments
 (0)