diff --git a/tests/infrastructure/golden_images/update_boot_source/test_ssp_data_import_crons.py b/tests/infrastructure/golden_images/update_boot_source/test_ssp_data_import_crons.py index 5dd81837..84587988 100644 --- a/tests/infrastructure/golden_images/update_boot_source/test_ssp_data_import_crons.py +++ b/tests/infrastructure/golden_images/update_boot_source/test_ssp_data_import_crons.py @@ -19,7 +19,7 @@ from tests.infrastructure.golden_images.update_boot_source.utils import ( template_labels, ) -from utilities.constants import TIMEOUT_1MIN, TIMEOUT_2MIN, TIMEOUT_5MIN, TIMEOUT_10MIN +from utilities.constants import BIND_IMMEDIATE_ANNOTATION, TIMEOUT_1MIN, TIMEOUT_2MIN, TIMEOUT_5MIN, TIMEOUT_10MIN from utilities.hco import ResourceEditorValidateHCOReconcile from utilities.infra import create_ns from utilities.ssp import ( @@ -224,11 +224,22 @@ def created_data_import_cron( with DataImportCron( name="data-import-cron-for-test", namespace=data_import_cron_namespace.name, - pull_method="node", - url=cron_template_spec.source.registry.url, - size=cron_template_spec.storage.resources.requests.storage, managed_data_source=golden_images_data_import_cron_spec.managedDataSource, schedule=golden_images_data_import_cron_spec.schedule, + annotations=BIND_IMMEDIATE_ANNOTATION, + template={ + "spec": { + "source": { + "registry": { + "url": cron_template_spec.source.registry.url, + "pullMethod": "node", + } + }, + "storage": { + "resources": {"requests": {"storage": cron_template_spec.storage.resources.requests.storage}} + }, + } + }, ) as data_import_cron: yield data_import_cron diff --git a/tests/storage/checkups/conftest.py b/tests/storage/checkups/conftest.py index 0ab4aeed..b8b58fd9 100644 --- a/tests/storage/checkups/conftest.py +++ b/tests/storage/checkups/conftest.py @@ -22,6 +22,7 @@ from tests.storage.utils import create_cirros_vm from tests.utils import get_image_from_csv from utilities.constants import ( + BIND_IMMEDIATE_ANNOTATION, OUTDATED, TIMEOUT_10MIN, VALUE_STR, @@ -197,13 +198,27 @@ def broken_data_import_cron(golden_images_namespace): with DataImportCron( name="broken-data-import-cron", namespace=golden_images_namespace.name, - image_stream=NON_EXISTENT_STR, - pull_method="node", - size="30Gi", schedule=WILDCARD_CRON_EXPRESSION, garbage_collect=OUTDATED, managed_data_source="broken-data-source", - bind_immediate_annotation=True, + annotations=BIND_IMMEDIATE_ANNOTATION, + template={ + "spec": { + "source": { + "registry": { + "imageStream": NON_EXISTENT_STR, + "pullMethod": "node", + } + }, + "storage": { + "resources": { + "requests": { + "storage": "30Gi", + } + } + }, + } + }, ) as data_import_cron: yield data_import_cron diff --git a/tests/storage/test_data_import_cron.py b/tests/storage/test_data_import_cron.py index e8672b2b..33d1b691 100644 --- a/tests/storage/test_data_import_cron.py +++ b/tests/storage/test_data_import_cron.py @@ -16,6 +16,7 @@ from timeout_sampler import TimeoutExpiredError, TimeoutSampler from utilities.constants import ( + BIND_IMMEDIATE_ANNOTATION, OUTDATED, TIMEOUT_1MIN, TIMEOUT_3MIN, @@ -111,15 +112,25 @@ def data_import_cron_image_stream(namespace, storage_class_name_scope_function): with DataImportCron( name=f"{RHEL8_STR}-image-import-cron", namespace=namespace.name, - image_stream=RHEL8_IMAGE_STREAM, - storage_class=storage_class_name_scope_function, - pull_method="node", - size=Images.Rhel.DEFAULT_DV_SIZE, - schedule=WILDCARD_CRON_EXPRESSION, garbage_collect=OUTDATED, - managed_data_source=RHEL8_STR, imports_to_keep=1, - bind_immediate_annotation=True, + managed_data_source=RHEL8_STR, + schedule=WILDCARD_CRON_EXPRESSION, + annotations=BIND_IMMEDIATE_ANNOTATION, + template={ + "spec": { + "source": { + "registry": { + "imageStream": RHEL8_IMAGE_STREAM, + "pullMethod": "node", + } + }, + "storage": { + "resources": {"requests": {"storage": Images.Rhel.DEFAULT_DV_SIZE}}, + "storageClassName": storage_class_name_scope_function, + }, + } + }, ) as data_import_cron: yield data_import_cron diff --git a/utilities/constants.py b/utilities/constants.py index bc95decc..a62d080b 100644 --- a/utilities/constants.py +++ b/utilities/constants.py @@ -781,3 +781,5 @@ class NamespacesNames: WIN_2K22 = "win2k22" PUBLIC_DNS_SERVER_IP = "8.8.8.8" + +BIND_IMMEDIATE_ANNOTATION = {f"{Resource.ApiGroup.CDI_KUBEVIRT_IO}/storage.bind.immediate.requested": "true"}