Skip to content

Commit 41702f7

Browse files
authored
utils: add client to create_dv and assert_pvc_snapshot_clone_annotation (#5120)
##### What this PR does / why we need it: Missing client on files causes warning: ``` openshift-virtualization-tests/.venv/lib64/python3.14/site-packages/ocp_resources/resource.py:1636: FutureWarning: 'client' arg will be mandatory in the next major release. `config_file` and `context` args will be removed. super().__init__( ``` This PR fixes the warning for `create_dv` and `assert_pvc_snapshot_clone_annotation` ##### Which issue(s) this PR fixes: `FutureWarning` showing ##### Special notes for reviewer: ##### jira-ticket: <!-- full-ticket-url needs to be provided. This would add a link to the pull request to the jira and close it when the pull request is merged If the task is not tracked by a Jira ticket, just write "NONE". --> NONE <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Updated test utilities to use the test cluster client when validating storage-related behavior, improving consistency and reliability. * **Chores** * Adjusted storage helper logic to retrieve secrets and config from the provided test client/namespace, ensuring correct cluster-scoped configuration handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: rkishner <rkishner@redhat.com>
1 parent ec593a3 commit 41702f7

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

tests/storage/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def assert_pvc_snapshot_clone_annotation(pvc, storage_class):
330330
clone_type_annotation_str = f"{Resource.ApiGroup.CDI_KUBEVIRT_IO}/cloneType"
331331
clone_type_annotation = pvc.instance["metadata"].get("annotations").get(clone_type_annotation_str)
332332
# For snapshot capable storage, 'csi-clone' may be set in the StorageProfile
333-
expected_clone_type_annotation = StorageProfile(name=storage_class).instance.status.cloneStrategy
333+
expected_clone_type_annotation = StorageProfile(name=storage_class, client=pvc.client).instance.status.cloneStrategy
334334
assert clone_type_annotation == expected_clone_type_annotation, (
335335
f"{clone_type_annotation_str}: {clone_type_annotation}, expected: '{expected_clone_type_annotation}'"
336336
)
@@ -451,7 +451,7 @@ def assert_num_files_in_pod(pod, expected_num_of_files):
451451

452452
def assert_use_populator(pvc, storage_class, cluster_csi_drivers_names):
453453
expected_use_populator_value = (
454-
StorageClass(name=storage_class).instance.get("provisioner") in cluster_csi_drivers_names
454+
StorageClass(name=storage_class, client=pvc.client).instance.get("provisioner") in cluster_csi_drivers_names
455455
)
456456
assert pvc.use_populator == expected_use_populator_value
457457

utilities/storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ def create_dv(
142142
# Make sure URL exists
143143
validate_file_exists_in_url(url=url)
144144
if not secret:
145-
secret = utilities.artifactory.get_artifactory_secret(namespace=namespace)
145+
secret = utilities.artifactory.get_artifactory_secret(namespace=namespace, client=client)
146146
artifactory_secret = secret
147147
if not cert_configmap:
148-
cert_created = utilities.artifactory.get_artifactory_config_map(namespace=namespace)
148+
cert_created = utilities.artifactory.get_artifactory_config_map(namespace=namespace, client=client)
149149
cert_configmap = cert_created.name
150150

151151
with DataVolume(

0 commit comments

Comments
 (0)