Skip to content

Commit 4de2dbd

Browse files
committed
CherryPicked: [cnv-4.20] Modified vm with cpu spec fixture to support s390x
The test for kubevirt_vmi_node_cpu_affinity is flaky duo to connectivity issues with the artifactory, in this PR I modified the test to not rely on the artifactory to avoid this kind of failures to stabilize the observability lanes.
1 parent ad4900f commit 4de2dbd

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
RHEL9_STR,
110110
RHEL_WITH_INSTANCETYPE_AND_PREFERENCE,
111111
RHSM_SECRET_NAME,
112+
S390X,
112113
SSP_CR_COMMON_TEMPLATES_LIST_KEY_NAME,
113114
TIMEOUT_3MIN,
114115
TIMEOUT_4MIN,
@@ -2901,3 +2902,8 @@ def application_aware_resource_quota(admin_client, namespace):
29012902
hard=ARQ_QUOTA_HARD_SPEC,
29022903
) as arq:
29032904
yield arq
2905+
2906+
2907+
@pytest.fixture(scope="session")
2908+
def is_s390x_cluster(nodes_cpu_architecture):
2909+
return nodes_cpu_architecture == S390X

tests/infrastructure/vhostmd/test_vhostmd.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from pytest_testconfig import config as py_config
1313

1414
from tests.os_params import RHEL_LATEST, RHEL_LATEST_LABELS, RHEL_LATEST_OS
15-
from utilities.constants import TIMEOUT_3MIN, TIMEOUT_30SEC
15+
from utilities.constants import S390X, TIMEOUT_3MIN, TIMEOUT_30SEC
1616
from utilities.hco import ResourceEditorValidateHCOReconcile
1717
from utilities.infra import get_artifactory_header, get_node_selector_dict, get_node_selector_name
1818
from utilities.virt import (
@@ -56,17 +56,15 @@ def enabled_downward_metrics_hco_featuregate(hyperconverged_resource_scope_modul
5656

5757

5858
@pytest.fixture(scope="module")
59-
def rpm_file_name(nodes_cpu_architecture):
59+
def rpm_file_name(is_s390x_cluster):
6060
soup_page = BeautifulSoup(
6161
markup=requests.get(RPMS_REPO_URL, headers=get_artifactory_header(), verify=False, timeout=TIMEOUT_30SEC).text,
6262
features="html.parser",
6363
)
6464
rpm_file_names = [link.get("href") for link in soup_page.find_all("a", href=re.compile(r"\.rpm$"))]
6565
assert rpm_file_names, f"No RPM files found at the URL - {RPMS_REPO_URL}"
6666

67-
return next(
68-
file_name for file_name in rpm_file_names if ("s390x" in file_name) == (nodes_cpu_architecture == "s390x")
69-
)
67+
return next(file_name for file_name in rpm_file_names if (S390X in file_name) == is_s390x_cluster)
7068

7169

7270
@pytest.fixture()

tests/observability/metrics/conftest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
KUBEVIRT_VMI_MEMORY_USABLE_BYTES,
4949
MIGRATION_POLICY_VM_LABEL,
5050
ONE_CPU_CORE,
51+
ONE_CPU_THREAD,
5152
OS_FLAVOR_FEDORA,
5253
SSP_OPERATOR,
5354
STRESS_CPU_MEM_IO_COMMAND,
@@ -242,14 +243,14 @@ def windows_vm_for_test_interface_name(windows_vm_for_test):
242243

243244

244245
@pytest.fixture(scope="class")
245-
def vm_with_cpu_spec(namespace, unprivileged_client):
246+
def vm_with_cpu_spec(namespace, unprivileged_client, is_s390x_cluster):
246247
name = "vm-resource-test"
247248
with VirtualMachineForTests(
248249
name=name,
249250
namespace=namespace.name,
250251
cpu_cores=TWO_CPU_CORES,
251252
cpu_sockets=TWO_CPU_SOCKETS,
252-
cpu_threads=TWO_CPU_THREADS,
253+
cpu_threads=ONE_CPU_THREAD if is_s390x_cluster else TWO_CPU_THREADS,
253254
body=fedora_vm_body(name=name),
254255
client=unprivileged_client,
255256
) as vm:

0 commit comments

Comments
 (0)