Skip to content

Commit

Permalink
Fix DataImportCron tests based on wrapper fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Geetika Kapoor <gkapoor@redhat.com>
  • Loading branch information
geetikakay committed Jan 21, 2025
1 parent 3b475dd commit ebe27a2
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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

Expand Down
23 changes: 19 additions & 4 deletions tests/storage/checkups/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down
25 changes: 18 additions & 7 deletions tests/storage/test_data_import_cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from timeout_sampler import TimeoutExpiredError, TimeoutSampler

from utilities.constants import (
BIND_IMMEDIATE_ANNOTATION,
OUTDATED,
TIMEOUT_1MIN,
TIMEOUT_3MIN,
Expand Down Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions utilities/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

0 comments on commit ebe27a2

Please sign in to comment.