Skip to content

Commit d86b69a

Browse files
committed
Merge branch 'main' into dequranetineRunbookUrlTest
2 parents c9b1302 + 9723d79 commit d86b69a

File tree

13 files changed

+67
-361
lines changed

13 files changed

+67
-361
lines changed

tests/infrastructure/instance_types/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@
1111

1212

1313
@pytest.fixture(scope="session")
14-
def base_vm_cluster_preferences():
14+
def base_vm_cluster_preferences(unprivileged_client):
1515
return list(
1616
VirtualMachineClusterPreference.get(
17+
client=unprivileged_client,
1718
label_selector=COMMON_INSTANCETYPE_SELECTOR,
1819
)
1920
)
2021

2122

2223
@pytest.fixture(scope="session")
23-
def base_vm_cluster_instancetypes():
24+
def base_vm_cluster_instancetypes(unprivileged_client):
2425
return list(
2526
VirtualMachineClusterInstancetype.get(
27+
client=unprivileged_client,
2628
label_selector=COMMON_INSTANCETYPE_SELECTOR,
2729
)
2830
)

tests/infrastructure/instance_types/supported_os/conftest.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def golden_image_fedora_vm_with_instance_type(
8989

9090
@pytest.fixture(scope="module")
9191
def windows_data_volume_template(
92+
unprivileged_client,
9293
namespace,
9394
windows_os_matrix__module__,
9495
):
@@ -97,6 +98,7 @@ def windows_data_volume_template(
9798
secret = get_artifactory_secret(namespace=namespace.name)
9899
cert = get_artifactory_config_map(namespace=namespace.name)
99100
win_dv = DataVolume(
101+
client=unprivileged_client,
100102
name=f"{os_matrix_key}-dv",
101103
namespace=namespace.name,
102104
api_name="storage",
@@ -125,9 +127,10 @@ def golden_image_windows_vm(
125127
client=unprivileged_client,
126128
name=f"{os_name}-vm-with-instance-type-2",
127129
namespace=namespace.name,
128-
vm_instance_type=VirtualMachineClusterInstancetype(name="u1.large"),
130+
vm_instance_type=VirtualMachineClusterInstancetype(client=unprivileged_client, name="u1.large"),
129131
vm_preference=VirtualMachineClusterPreference(
130-
name=windows_os_matrix__module__[os_name][DATA_SOURCE_STR].replace("win", "windows.")
132+
client=unprivileged_client,
133+
name=windows_os_matrix__module__[os_name][DATA_SOURCE_STR].replace("win", "windows."),
131134
),
132135
data_volume_template=windows_data_volume_template.res,
133136
os_flavor="win-container-disk",

tests/infrastructure/instance_types/supported_os/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def golden_image_vm_with_instance_type(
2121
vm_preference_infer=True,
2222
data_volume_template=data_volume_template_with_source_ref_dict(
2323
data_source=DataSource(
24+
client=client,
2425
name=data_source_name,
2526
namespace=golden_images_namespace_name,
2627
),

tests/infrastructure/instance_types/test_common_vm_instancetype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_cx1_instancetype_profile(xfail_if_no_huge_pages, unprivileged_client, n
2727
name="rhel-vm-with-cx1",
2828
namespace=namespace.name,
2929
image=Images.Rhel.RHEL9_REGISTRY_GUEST_IMG,
30-
vm_instance_type=VirtualMachineClusterInstancetype(name="cx1.medium1gi"),
30+
vm_instance_type=VirtualMachineClusterInstancetype(client=unprivileged_client, name="cx1.medium1gi"),
3131
) as vm:
3232
running_vm(vm=vm, wait_for_interfaces=False, check_ssh_connectivity=False)
3333

tests/infrastructure/instance_types/test_cpu_memory_hotplug_instancetype.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ def instance_type_hotplug_vm(
5353

5454

5555
@pytest.fixture(scope="module")
56-
def available_rwx_storage_class_name(available_storage_classes_names):
56+
def available_rwx_storage_class_name(unprivileged_client, available_storage_classes_names):
5757
for storage_class_name in available_storage_classes_names:
5858
if (
59-
StorageProfile(name=storage_class_name).first_claim_property_set_access_modes()[0]
59+
StorageProfile(client=unprivileged_client, name=storage_class_name).first_claim_property_set_access_modes()[
60+
0
61+
]
6062
== DataVolume.AccessMode.RWX
6163
):
6264
return storage_class_name
@@ -97,8 +99,9 @@ def hotplugged_six_sockets_instance_type(admin_client, instance_type_hotplug_vm,
9799

98100

99101
@pytest.fixture(scope="class")
100-
def hotplug_vm_snapshot_instance_type(instance_type_hotplug_vm):
102+
def hotplug_vm_snapshot_instance_type(instance_type_hotplug_vm, unprivileged_client):
101103
with VirtualMachineSnapshot(
104+
client=unprivileged_client,
102105
name=f"{instance_type_hotplug_vm.name}-snapshot",
103106
namespace=instance_type_hotplug_vm.namespace,
104107
vm_name=instance_type_hotplug_vm.name,

tests/infrastructure/instance_types/test_update_vm_with_instancetype_preference.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,20 @@ def get_mismatched_fields_list(
4141

4242

4343
@pytest.fixture()
44-
def vm_cluster_instance_type_to_update():
44+
def vm_cluster_instance_type_to_update(unprivileged_client):
4545
cluster_instancetype_list = list(
4646
VirtualMachineClusterInstancetype.get(
47-
label_selector="instancetype.kubevirt.io/memory=4Gi, instancetype.kubevirt.io/cpu=1"
47+
client=unprivileged_client,
48+
label_selector="instancetype.kubevirt.io/memory=4Gi, instancetype.kubevirt.io/cpu=1",
4849
)
4950
)
5051
assert cluster_instancetype_list, "No cluster instance type found on the cluster"
5152
return cluster_instancetype_list[0]
5253

5354

5455
@pytest.fixture()
55-
def rhel_9_vm_cluster_preference():
56-
return VirtualMachineClusterPreference(name="rhel.9")
56+
def rhel_9_vm_cluster_preference(unprivileged_client):
57+
return VirtualMachineClusterPreference(client=unprivileged_client, name="rhel.9")
5758

5859

5960
@pytest.fixture()

tests/infrastructure/instance_types/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def get_controller_revision(
3131
}
3232

3333
return ControllerRevision(
34+
client=vm_instance.client,
3435
name=ref_mapping[ref_type],
3536
namespace=vm_instance.namespace,
3637
)

0 commit comments

Comments
 (0)