|
3 | 3 | import pytest |
4 | 4 | from ocp_resources.resource import Resource |
5 | 5 | from ocp_resources.virtual_machine import VirtualMachine |
6 | | -from pytest_testconfig import config as py_config |
7 | 6 |
|
| 7 | +from tests.observability.metrics.constants import KUBEVIRT_VMI_NODE_CPU_AFFINITY |
8 | 8 | from tests.observability.metrics.utils import ( |
9 | 9 | validate_vmi_node_cpu_affinity_with_prometheus, |
10 | 10 | ) |
11 | 11 | from tests.observability.utils import validate_metrics_value |
12 | | -from tests.os_params import RHEL_LATEST, RHEL_LATEST_LABELS, RHEL_LATEST_OS |
13 | 12 | from utilities.virt import VirtualMachineForTests, fedora_vm_body, running_vm |
14 | 13 |
|
15 | 14 | KUBEVIRT_VM_TAG = f"{Resource.ApiGroup.KUBEVIRT_IO}/vm" |
@@ -41,37 +40,23 @@ def fedora_vm_without_name_in_label( |
41 | 40 | client=unprivileged_client, |
42 | 41 | run_strategy=VirtualMachine.RunStrategy.ALWAYS, |
43 | 42 | ) as vm: |
44 | | - running_vm(vm=vm, check_ssh_connectivity=False) |
| 43 | + running_vm(vm=vm, wait_for_interfaces=False, check_ssh_connectivity=False) |
45 | 44 | yield vm |
46 | 45 |
|
47 | 46 |
|
48 | 47 | class TestVmiNodeCpuAffinityLinux: |
49 | | - @pytest.mark.parametrize( |
50 | | - "golden_image_data_volume_scope_class, vm_from_template_scope_class", |
51 | | - [ |
52 | | - pytest.param( |
53 | | - { |
54 | | - "dv_name": RHEL_LATEST_OS, |
55 | | - "image": RHEL_LATEST["image_path"], |
56 | | - "storage_class": py_config["default_storage_class"], |
57 | | - "dv_size": RHEL_LATEST["dv_size"], |
58 | | - }, |
59 | | - { |
60 | | - "vm_name": "rhel-latest", |
61 | | - "template_labels": RHEL_LATEST_LABELS, |
62 | | - "guest_agent": False, |
63 | | - "ssh": False, |
64 | | - }, |
65 | | - ), |
66 | | - ], |
67 | | - indirect=True, |
68 | | - ) |
69 | 48 | @pytest.mark.polarion("CNV-7295") |
70 | 49 | @pytest.mark.s390x |
71 | | - def test_kubevirt_vmi_node_cpu_affinity(self, prometheus, vm_from_template_scope_class): |
72 | | - validate_vmi_node_cpu_affinity_with_prometheus( |
73 | | - vm=vm_from_template_scope_class, |
| 50 | + def test_kubevirt_vmi_node_cpu_affinity( |
| 51 | + self, |
| 52 | + prometheus, |
| 53 | + vm_with_cpu_spec, |
| 54 | + expected_cpu_affinity_metric_value, |
| 55 | + ): |
| 56 | + validate_metrics_value( |
74 | 57 | prometheus=prometheus, |
| 58 | + metric_name=KUBEVIRT_VMI_NODE_CPU_AFFINITY.format(vm_name=vm_with_cpu_spec.name), |
| 59 | + expected_value=expected_cpu_affinity_metric_value, |
75 | 60 | ) |
76 | 61 |
|
77 | 62 |
|
|
0 commit comments