-
Notifications
You must be signed in to change notification settings - Fork 72
infra: Update dv_for_data_source to create the dv from public quay #5592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,20 +17,15 @@ | |
| PVC_NOT_FOUND_ERROR, | ||
| ) | ||
| from tests.utils import get_parameters_from_template | ||
| from utilities.artifactory import ( | ||
| cleanup_artifactory_secret_and_config_map, | ||
| get_artifactory_config_map, | ||
| get_artifactory_secret, | ||
| get_http_image_url, | ||
| ) | ||
| from utilities.constants import Images | ||
| from utilities.constants.hco import DATA_SOURCE_NAME | ||
| from utilities.constants.images import DEFAULT_FEDORA_REGISTRY_URL | ||
| from utilities.constants.pytest import QUARANTINED | ||
| from utilities.constants.storage import BIND_IMMEDIATE_ANNOTATION | ||
| from utilities.constants.storage import BIND_IMMEDIATE_ANNOTATION, REGISTRY_STR | ||
| from utilities.constants.timeouts import ( | ||
| TIMEOUT_5MIN, | ||
| TIMEOUT_10MIN, | ||
| TIMEOUT_30SEC, | ||
| ) | ||
| from utilities.exceptions import ResourceValueError | ||
| from utilities.ssp import wait_for_condition_message_value | ||
|
|
@@ -41,26 +36,20 @@ | |
| TESTS_AUTO_UPDATE_BOOT_SOURCE_NAME = [*py_config["auto_update_data_source_matrix"][0]][0] | ||
| DUMMY_VOLUME_NAME = "dummy" | ||
| DATA_SOURCE_MANAGED_BY_CDI_LABEL = f"{DataSource.ApiGroup.CDI_KUBEVIRT_IO}/dataImportCron" | ||
| RECONCILE_TRIGGER_ANNOTATION = "reconcile-trigger" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leftover ? |
||
|
|
||
| pytestmark = pytest.mark.post_upgrade | ||
|
|
||
|
|
||
| @contextmanager | ||
| def dv_for_data_source(name, data_source, admin_client): | ||
| artifactory_secret = get_artifactory_secret(namespace=data_source.namespace) | ||
| artifactory_config_map = get_artifactory_config_map(namespace=data_source.namespace) | ||
| with DataVolume( | ||
| client=admin_client, | ||
| name=name, | ||
| namespace=data_source.namespace, | ||
| source_dict=construct_datavolume_source_dict( | ||
| # underlying OS is not relevant | ||
| source="http", | ||
| url=get_http_image_url(image_directory=Images.Cirros.DIR, image_name=Images.Cirros.QCOW2_IMG), | ||
| secret_name=artifactory_secret.name, | ||
| cert_configmap_name=artifactory_config_map.name, | ||
| ), | ||
| size=Images.Cirros.DEFAULT_DV_SIZE, | ||
| # underlying OS is not relevant | ||
| source_dict=construct_datavolume_source_dict(source=REGISTRY_STR, url=DEFAULT_FEDORA_REGISTRY_URL), | ||
| size=Images.Fedora.DEFAULT_DV_SIZE, | ||
|
Comment on lines
+51
to
+52
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't it be better to clone from a golden image to reduce the dependency on quay?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean from a
Comment on lines
44
to
+52
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Move local helpers and fixtures to dedicated modules. HIGH severity. Defining helper functions and fixtures inside As per coding guidelines: "Do not define helper functions, utility functions, or classes in conftest.py or test_*.py; place them in dedicated utility modules... keep local helpers in Please relocate these to their appropriate files. When moving the helpers, ensure they include Google-format docstrings as required for public functions.
📍 Affects 1 file
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| storage_class=py_config["default_storage_class"], | ||
| annotations=BIND_IMMEDIATE_ANNOTATION, | ||
| api_name="storage", | ||
|
|
@@ -71,9 +60,6 @@ def dv_for_data_source(name, data_source, admin_client): | |
| expected_message=DATA_SOURCE_READY_FOR_CONSUMPTION_MESSAGE, | ||
| ) | ||
| yield dv | ||
| cleanup_artifactory_secret_and_config_map( | ||
| artifactory_secret=artifactory_secret, artifactory_config_map=artifactory_config_map | ||
| ) | ||
|
|
||
|
|
||
| def opt_in_status_str(opt_in): | ||
|
|
@@ -100,7 +86,7 @@ def wait_for_data_source_reconciliation_after_update( | |
| def wait_for_data_source_unchanged_referenced_volume(data_source, volume_name): | ||
| try: | ||
| for sample in TimeoutSampler( | ||
| wait_timeout=TIMEOUT_10MIN, | ||
| wait_timeout=TIMEOUT_30SEC, | ||
| sleep=5, | ||
| func=lambda: data_source.source.name != volume_name, | ||
| ): | ||
|
|
@@ -265,8 +251,8 @@ def data_sources_from_templates_scope_function(admin_client, data_sources_names_ | |
|
|
||
|
|
||
| @pytest.fixture() | ||
| def data_source_by_name_scope_function(request, unprivileged_client, golden_images_namespace): | ||
| return DataSource(client=unprivileged_client, name=request.param, namespace=golden_images_namespace.name) | ||
| def data_source_by_name_scope_function(request, admin_client, golden_images_namespace): | ||
| return DataSource(client=admin_client, name=request.param, namespace=golden_images_namespace.name) | ||
|
|
||
|
|
||
| @pytest.fixture(scope="class") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Execution Plan
post_upgrade; it has nosmokemarker, and this PR does not modify sharedutilities/,libs/, orconftest.pycode that could transitively affect smoke coverage.gatingmarker, and there are no shared-code changes that could affect gating tests.tests/infrastructure/golden_images/update_boot_source/test_ssp_data_sources.py::test_upload_dv_for_auto_update_dangling_data_sources(post_upgrade) — exercisesdata_source_by_name_scope_function→uploaded_dv_for_dangling_data_source_scope_function→dv_for_data_source, including the new public-Quay Fedora registry import.tests/infrastructure/golden_images/update_boot_source/test_ssp_data_sources.py::test_data_source_with_existing_golden_image_pvc(post_upgrade) — exercisesdata_source_by_name_scope_function→created_dv_for_data_import_cron_managed_data_source_scope_function→dv_for_data_sourceand the reduced unchanged-reference timeout.Real tests (cluster required)
Error/fix path (public registry import):
pytest tests/infrastructure/golden_images/update_boot_source/test_ssp_data_sources.py::test_upload_dv_for_auto_update_dangling_data_sourcesExpected: the Fedora DataVolume imports from public Quay and the DataSource condition reaches the parameterized expected state.
Happy path (existing golden-image PVC):
pytest tests/infrastructure/golden_images/update_boot_source/test_ssp_data_sources.py::test_data_source_with_existing_golden_image_pvcExpected: the manually created Fedora DataVolume is consumed and the DataSource reference remains unchanged throughout the 30-second verification window.