Skip to content

Commit 0267c66

Browse files
authored
tests, net, kmp: Add client arg (#2980)
##### Short description: Updated VM fixtures - all calls to openshift-python-wrapper resource should be updated to pass client. ##### What this PR does / why we need it: As of its next release, openshift-python-wrapper will enforce passing client when working with cluster resources. openshift-virtualization-tests must align with this change. All calls in the code to openshift-python-wrapper resources should be updated to pass client arg. Since the KMP NS is created with an admin_client the VMs must be created with the same client - VMs under a namespace that is not created by a project admin require admin privileges. ##### jira-ticket: https://issues.redhat.com/browse/CNV-72392 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Fixtures updated to exercise VMs with elevated/admin access to cover additional scenarios. * VMs are started and waited on during setup so tests hit running state deterministically. * Added explicit teardown to remove allocated MACs, preventing leftover network state. * Improves lifecycle validation and overall reliability across network MAC pool configurations. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 6c52b1c + fd67fcc commit 0267c66

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/network/kubemacpool/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def restarted_vmi_b(vm_b):
265265

266266

267267
@pytest.fixture(scope="class")
268-
def disabled_ns_vm(unprivileged_client, disabled_ns, disabled_ns_nad, mac_pool):
268+
def disabled_ns_vm(admin_client, disabled_ns, disabled_ns_nad, mac_pool):
269269
networks = {disabled_ns_nad.name: disabled_ns_nad.name}
270270
name = f"{disabled_ns.name}-vm"
271271
with VirtualMachineForTests(
@@ -274,7 +274,7 @@ def disabled_ns_vm(unprivileged_client, disabled_ns, disabled_ns_nad, mac_pool):
274274
networks=networks,
275275
interfaces=networks.keys(),
276276
body=fedora_vm_body(name=name),
277-
client=unprivileged_client,
277+
client=admin_client,
278278
) as vm:
279279
mac_pool.append_macs(vm=vm)
280280
vm.start(wait=True)
@@ -284,7 +284,7 @@ def disabled_ns_vm(unprivileged_client, disabled_ns, disabled_ns_nad, mac_pool):
284284

285285

286286
@pytest.fixture(scope="class")
287-
def enabled_ns_vm(unprivileged_client, kmp_enabled_ns, enabled_ns_nad, mac_pool):
287+
def enabled_ns_vm(admin_client, kmp_enabled_ns, enabled_ns_nad, mac_pool):
288288
networks = {enabled_ns_nad.name: enabled_ns_nad.name}
289289
name = f"{kmp_enabled_ns.name}-vm"
290290
with VirtualMachineForTests(
@@ -293,7 +293,7 @@ def enabled_ns_vm(unprivileged_client, kmp_enabled_ns, enabled_ns_nad, mac_pool)
293293
networks=networks,
294294
interfaces=networks.keys(),
295295
body=fedora_vm_body(name=name),
296-
client=unprivileged_client,
296+
client=admin_client,
297297
) as vm:
298298
mac_pool.append_macs(vm=vm)
299299
vm.start(wait=True)
@@ -303,7 +303,7 @@ def enabled_ns_vm(unprivileged_client, kmp_enabled_ns, enabled_ns_nad, mac_pool)
303303

304304

305305
@pytest.fixture(scope="class")
306-
def no_label_ns_vm(unprivileged_client, no_label_ns, no_label_ns_nad, mac_pool):
306+
def no_label_ns_vm(admin_client, no_label_ns, no_label_ns_nad, mac_pool):
307307
networks = {no_label_ns_nad.name: no_label_ns_nad.name}
308308
name = f"{no_label_ns.name}-vm"
309309
with VirtualMachineForTests(
@@ -312,7 +312,7 @@ def no_label_ns_vm(unprivileged_client, no_label_ns, no_label_ns_nad, mac_pool):
312312
networks=networks,
313313
interfaces=networks.keys(),
314314
body=fedora_vm_body(name=name),
315-
client=unprivileged_client,
315+
client=admin_client,
316316
) as vm:
317317
mac_pool.append_macs(vm=vm)
318318
vm.start(wait=True)

0 commit comments

Comments
 (0)