|
4 | 4 | import bitmath |
5 | 5 | import pytest |
6 | 6 | from ocp_resources.data_source import DataSource |
| 7 | +from ocp_resources.datavolume import DataVolume |
7 | 8 | from ocp_resources.deployment import Deployment |
8 | 9 | from ocp_resources.pod import Pod |
9 | 10 | from ocp_resources.resource import ResourceEditor |
|
39 | 40 | from tests.utils import create_vms, start_stress_on_vm |
40 | 41 | from utilities import console |
41 | 42 | from utilities.constants import ( |
| 43 | + DEFAULT_FEDORA_REGISTRY_URL, |
42 | 44 | IPV4_STR, |
43 | 45 | KUBEVIRT_VMI_MEMORY_PGMAJFAULT_TOTAL, |
44 | 46 | KUBEVIRT_VMI_MEMORY_PGMINFAULT_TOTAL, |
|
50 | 52 | ONE_CPU_CORE, |
51 | 53 | ONE_CPU_THREAD, |
52 | 54 | OS_FLAVOR_FEDORA, |
| 55 | + REGISTRY_STR, |
53 | 56 | SSP_OPERATOR, |
54 | 57 | STRESS_CPU_MEM_IO_COMMAND, |
55 | 58 | TIMEOUT_2MIN, |
|
85 | 88 | VirtualMachineForTests, |
86 | 89 | fedora_vm_body, |
87 | 90 | running_vm, |
| 91 | + vm_instance_from_template, |
88 | 92 | ) |
89 | 93 | from utilities.vnc_utils import VNCConnection |
90 | 94 |
|
@@ -660,3 +664,27 @@ def expected_cpu_affinity_metric_value(vm_with_cpu_spec): |
660 | 664 |
|
661 | 665 | # return multiplication for multi-CPU VMs |
662 | 666 | return str(cpu_count_from_vm_node * cpu_count_from_vm) |
| 667 | + |
| 668 | + |
| 669 | +@pytest.fixture() |
| 670 | +def vm_with_rwo_dv(request, unprivileged_client, namespace): |
| 671 | + dv = DataVolume( |
| 672 | + client=unprivileged_client, |
| 673 | + source=REGISTRY_STR, |
| 674 | + name="non-evictable-vm-dv-for-test", |
| 675 | + namespace=namespace.name, |
| 676 | + url=DEFAULT_FEDORA_REGISTRY_URL, |
| 677 | + size=Images.Fedora.DEFAULT_DV_SIZE, |
| 678 | + storage_class=py_config["default_storage_class"], |
| 679 | + access_modes=DataVolume.AccessMode.RWO, |
| 680 | + api_name="storage", |
| 681 | + ) |
| 682 | + dv.to_dict() |
| 683 | + dv_res = dv.res |
| 684 | + with vm_instance_from_template( |
| 685 | + request=request, |
| 686 | + unprivileged_client=unprivileged_client, |
| 687 | + namespace=namespace, |
| 688 | + data_volume_template={"metadata": dv_res["metadata"], "spec": dv_res["spec"]}, |
| 689 | + ) as vm: |
| 690 | + yield vm |
0 commit comments