Skip to content

Commit 0a59f98

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 19144b8 commit 0a59f98

28 files changed

Lines changed: 102 additions & 162 deletions

tests/conftest.py

Lines changed: 17 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.artifactory import get_artifactory_header, get_http_image_url, get_test_artifact_server_url
7575
from utilities.bitwarden import get_cnv_tests_secret_by_name
7676
from utilities.constants import (
@@ -108,7 +108,6 @@
108108
RHEL9_STR,
109109
RHEL_WITH_INSTANCETYPE_AND_PREFERENCE,
110110
RHSM_SECRET_NAME,
111-
S390X,
112111
SSP_CR_COMMON_TEMPLATES_LIST_KEY_NAME,
113112
TIMEOUT_3MIN,
114113
TIMEOUT_4MIN,
@@ -161,6 +160,7 @@
161160
scale_deployment_replicas,
162161
wait_for_pods_deletion,
163162
)
163+
from utilities.jira import is_jira_open
164164
from utilities.network import (
165165
EthernetNetworkConfigurationPolicy,
166166
MacPool,
@@ -214,6 +214,9 @@
214214
wait_for_windows_vm,
215215
)
216216

217+
from .utils import download_and_extract_tar, update_cluster_cpu_model
218+
from .virt.constants import MachineTypesNames
219+
217220
LOGGER = logging.getLogger(__name__)
218221
HTTP_SECRET_NAME = "htpass-secret-for-cnv-tests"
219222
HTPASSWD_PROVIDER_DICT = {
@@ -2768,12 +2771,22 @@ def cluster_modern_cpu_model_scope_class(
27682771
wait_for_kv_stabilize(admin_client=admin_client, hco_namespace=hco_namespace)
27692772

27702773

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+
27712784
@pytest.fixture(scope="module")
2772-
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):
27732786
"""Extract machine type default from kubevirt CR."""
27742787
# Workaround for s390x (https://github.com/kubevirt/kubevirt/issues/14953), as machine type missing in config and
27752788
# hardcoded to s390_ccw_virtio in kubevirt code.
2776-
if nodes_cpu_architecture == S390X:
2789+
if is_s390x_cluster and is_jira_open("CNV-71825"):
27772790
mc_type = "s390-ccw-virtio"
27782791
else:
27792792
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
@@ -286,7 +286,7 @@ def update_cluster_cpu_model(admin_client, hco_namespace, hco_resource, cpu_mode
286286
hco_namespace=hco_namespace,
287287
path=["cpuModel"],
288288
value=cpu_model,
289-
timeout=120,
289+
timeout=30,
290290
)
291291
yield
292292

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.jira import is_jira_open
@@ -77,7 +76,7 @@ def hotplugged_vm(
7776
golden_image_data_source_scope_class,
7877
modern_cpu_for_migration,
7978
vmx_disabled_flag,
80-
nodes_cpu_architecture,
79+
is_s390x_cluster,
8180
):
8281
with VirtualMachineForTestsFromTemplate(
8382
name=request.param["vm_name"],
@@ -87,8 +86,8 @@ def hotplugged_vm(
8786
client=unprivileged_client,
8887
data_source=golden_image_data_source_scope_class,
8988
cpu_max_sockets=EIGHT_CPU_SOCKETS,
90-
# s390x doesn't support maxGuest as it doesn't support hotplug
91-
memory_max_guest=TEN_GI_MEMORY if nodes_cpu_architecture != S390X else None,
89+
# s390x doesn't support maxGuest as it doesn't support hotplug memory
90+
memory_max_guest=None if is_s390x_cluster else TEN_GI_MEMORY,
9291
cpu_sockets=FOUR_CPU_SOCKETS,
9392
cpu_threads=ONE_CPU_THREAD,
9493
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
@@ -88,7 +88,7 @@ def rhel_8_10_vm(unprivileged_client, namespace, rhel_8_10_ds):
8888
)
8989
],
9090
)
91-
@pytest.mark.x86_64 # no legacy machinetype for s390x which is different from emulated machine types
91+
# For s390x, there is no legacy machinetype which is different from emulated machine types
9292
def test_legacy_machine_type(
9393
updated_hco_emulated_machine_i440fx,
9494
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)