From bad79fff4df51e0e8bcc986745b9ced84688e208 Mon Sep 17 00:00:00 2001 From: Tobias Grigo Date: Wed, 19 Jun 2024 11:31:32 +0200 Subject: [PATCH] Raise pulpcore requirement to 3.55+ closes #1100 --- CHANGES/1100.feature | 1 + .../functional/api/test_download_policies.py | 6 ++-- .../api/test_pulpexport_pulpimport.py | 33 ++++++++----------- .../functional/api/test_source_package.py | 6 ++-- pulp_deb/tests/functional/api/test_sync.py | 6 ++-- pulp_deb/tests/functional/conftest.py | 4 +-- requirements.txt | 2 +- 7 files changed, 28 insertions(+), 30 deletions(-) create mode 100644 CHANGES/1100.feature diff --git a/CHANGES/1100.feature b/CHANGES/1100.feature new file mode 100644 index 000000000..2998e4fbd --- /dev/null +++ b/CHANGES/1100.feature @@ -0,0 +1 @@ +Made the plugin compatible with pulpcore 3.55.0+. diff --git a/pulp_deb/tests/functional/api/test_download_policies.py b/pulp_deb/tests/functional/api/test_download_policies.py index 3c2d0403a..75c42f507 100644 --- a/pulp_deb/tests/functional/api/test_download_policies.py +++ b/pulp_deb/tests/functional/api/test_download_policies.py @@ -42,7 +42,7 @@ def test_download_policy( @pytest.mark.parametrize("remote_args", [{"policy": "on_demand"}, {"policy": "streamed"}]) def test_lazy_sync_immediate_download_test( - artifacts_api_client, + pulpcore_bindings, deb_init_and_sync, deb_get_remote_by_href, deb_patch_remote, @@ -57,7 +57,7 @@ def test_lazy_sync_immediate_download_test( repo, remote = deb_init_and_sync(remote_args=remote_args) # Verify amount of artifacts are equal to NON_LAZY_ARTIFACT_COUNT - artifacts = artifacts_api_client.list() + artifacts = pulpcore_bindings.ArtifactsApi.list() assert artifacts.count == NON_LAZY_ARTIFACT_COUNT # Update remote policy to immediate and verify it is set @@ -67,5 +67,5 @@ def test_lazy_sync_immediate_download_test( # Sync with updated remote and verify the correct amount artifacts repo, _ = deb_init_and_sync(repository=repo, remote=remote) - artifacts = artifacts_api_client.list() + artifacts = pulpcore_bindings.ArtifactsApi.list() assert artifacts.count == NON_LAZY_ARTIFACT_COUNT + DEB_FIXTURE_PACKAGE_COUNT diff --git a/pulp_deb/tests/functional/api/test_pulpexport_pulpimport.py b/pulp_deb/tests/functional/api/test_pulpexport_pulpimport.py index 4f519e874..d1130a6d3 100644 --- a/pulp_deb/tests/functional/api/test_pulpexport_pulpimport.py +++ b/pulp_deb/tests/functional/api/test_pulpexport_pulpimport.py @@ -52,9 +52,7 @@ def _deb_gen_import_export_repos(import_repos=None, export_repos=None): @pytest.fixture -def deb_create_exporter( - gen_object_with_cleanup, exporters_pulp_api_client, deb_gen_import_export_repos -): +def deb_create_exporter(gen_object_with_cleanup, pulpcore_bindings, deb_gen_import_export_repos): """A fixture that creates a pulp exporter.""" def _deb_create_exporter(import_repos=None, export_repos=None): @@ -72,13 +70,13 @@ def _deb_create_exporter(import_repos=None, export_repos=None): "repositories": [r.pulp_href for r in export_repos], "path": f"/tmp/{uuid4()}/", } - return gen_object_with_cleanup(exporters_pulp_api_client, body) + return gen_object_with_cleanup(pulpcore_bindings.ExportersPulpApi, body) return _deb_create_exporter @pytest.fixture -def deb_create_export(exporters_pulp_exports_api_client, deb_create_exporter, monitor_task): +def deb_create_export(pulpcore_bindings, deb_create_exporter, monitor_task): """A fixture that creates a pulp export.""" def _deb_create_export(import_repos=None, export_repos=None, exporter=None, is_chunked=False): @@ -94,17 +92,15 @@ def _deb_create_export(import_repos=None, export_repos=None, exporter=None, is_c exporter = deb_create_exporter(import_repos, export_repos) body = {"chunk_size": "5KB"} if is_chunked else {} - export_response = exporters_pulp_exports_api_client.create(exporter.pulp_href, body) + export_response = pulpcore_bindings.ExportersPulpExportsApi.create(exporter.pulp_href, body) export_href = monitor_task(export_response.task).created_resources[0] - return exporters_pulp_exports_api_client.read(export_href) + return pulpcore_bindings.ExportersPulpExportsApi.read(export_href) return _deb_create_export @pytest.fixture -def deb_importer_factory( - gen_object_with_cleanup, deb_gen_import_export_repos, importers_pulp_api_client -): +def deb_importer_factory(gen_object_with_cleanup, deb_gen_import_export_repos, pulpcore_bindings): """A fixture that creates a pulp importer.""" def _deb_importer_factory( @@ -136,7 +132,7 @@ def _deb_importer_factory( mapping[repo.name] = import_repos[idx].name body["repo_mapping"] = mapping - return gen_object_with_cleanup(importers_pulp_api_client, body) + return gen_object_with_cleanup(pulpcore_bindings.ImportersPulpApi, body) return _deb_importer_factory @@ -145,7 +141,7 @@ def _deb_importer_factory( def deb_perform_import( deb_create_export, deb_gen_import_export_repos, - importers_pulp_imports_api_client, + pulpcore_bindings, monitor_task_group, ): """A fixture that performs an import with a PulpImporter.""" @@ -186,7 +182,7 @@ def _deb_perform_import( if "path" not in body: body["path"] = _find_path(an_export) - import_response = importers_pulp_imports_api_client.create(importer.pulp_href, body) + import_response = pulpcore_bindings.ImportersPulpImportsApi.create(importer.pulp_href, body) task_group = monitor_task_group(import_response.task_group) return task_group @@ -218,7 +214,7 @@ def test_double_import( deb_get_repository_by_href, deb_importer_factory, deb_perform_import, - importers_pulp_imports_api_client, + pulpcore_bindings, ): """Test two PulpImports for a PulpExport.""" import_repos, export_repos = deb_gen_import_export_repos() @@ -226,7 +222,7 @@ def test_double_import( deb_perform_import(importer, import_repos, export_repos) deb_perform_import(importer, import_repos, export_repos) - imports = importers_pulp_imports_api_client.list(importer.pulp_href).results + imports = pulpcore_bindings.ImportersPulpImportsApi.list(importer.pulp_href).results assert len(imports) == 2 for repo in import_repos: @@ -256,9 +252,8 @@ def test_import_create_repos( deb_importer_factory, deb_init_and_sync, deb_perform_import, - exporters_pulp_api_client, + pulpcore_bindings, monitor_task, - orphans_cleanup_api_client, delete_orphans_pre, ): """Test whether PulpImporter can create repositories.""" @@ -283,10 +278,10 @@ def test_import_create_repos( assert "//" not in an_export_filename # Clean up exporter, repos and orphans - exporters_pulp_api_client.delete(exporter.pulp_href) + pulpcore_bindings.ExportersPulpApi.delete(exporter.pulp_href) deb_delete_remote(remote) deb_delete_repository(repo) - monitor_task(orphans_cleanup_api_client.cleanup({"orphan_protection_time": 0}).task) + monitor_task(pulpcore_bindings.OrphansCleanupApi.cleanup({"orphan_protection_time": 0}).task) # Remember the amount of repositories present before the import existing_repos = apt_repository_api.list().count diff --git a/pulp_deb/tests/functional/api/test_source_package.py b/pulp_deb/tests/functional/api/test_source_package.py index 1768f8400..26ecada28 100644 --- a/pulp_deb/tests/functional/api/test_source_package.py +++ b/pulp_deb/tests/functional/api/test_source_package.py @@ -34,7 +34,7 @@ def _find_existing_artifact(artifacts_api, exc): @pytest.fixture def artifact_factory( - artifacts_api_client, + pulpcore_bindings, gen_object_with_cleanup, ): """Factory to create an artifact.""" @@ -42,9 +42,9 @@ def artifact_factory( def _artifact_factory(relative_name, relative_path=SOURCE_PACKAGE_PATH): try: file = get_local_package_absolute_path(relative_name, relative_path=relative_path) - artifact = gen_object_with_cleanup(artifacts_api_client, file) + artifact = gen_object_with_cleanup(pulpcore_bindings.ArtifactsApi, file) except ApiException as exc: - if artifact := _find_existing_artifact(artifacts_api_client, exc): + if artifact := _find_existing_artifact(pulpcore_bindings.ArtifactsApi, exc): return artifact else: raise diff --git a/pulp_deb/tests/functional/api/test_sync.py b/pulp_deb/tests/functional/api/test_sync.py index fde4c207d..ffa52013e 100644 --- a/pulp_deb/tests/functional/api/test_sync.py +++ b/pulp_deb/tests/functional/api/test_sync.py @@ -350,7 +350,7 @@ def test_sync_optimize_with_mirror_enabled(deb_init_and_sync): def test_sync_orphan_cleanup_fail( deb_init_and_sync, - orphans_cleanup_api_client, + pulpcore_bindings, monitor_task, delete_orphans_pre, ): @@ -372,7 +372,9 @@ def test_sync_orphan_cleanup_fail( # Trigger orphan cleanup without protection time and verify the task completed # and Content and Artifacts have been removed. - task = monitor_task(orphans_cleanup_api_client.cleanup({"orphan_protection_time": 0}).task) + task = monitor_task( + pulpcore_bindings.OrphansCleanupApi.cleanup({"orphan_protection_time": 0}).task + ) assert task.state == "completed" for report in task.progress_reports: if "Content" in report.message: diff --git a/pulp_deb/tests/functional/conftest.py b/pulp_deb/tests/functional/conftest.py index 5639e18d5..5c265d845 100644 --- a/pulp_deb/tests/functional/conftest.py +++ b/pulp_deb/tests/functional/conftest.py @@ -490,7 +490,7 @@ def deb_signing_script_path( def deb_signing_service_factory( deb_signing_script_path, signing_gpg_metadata, - signing_service_api_client, + pulpcore_bindings, ): """A fixture for the debian signing service.""" gpg, fingerprint, keyid = signing_gpg_metadata @@ -510,7 +510,7 @@ def deb_signing_service_factory( assert process.returncode == 0 - signing_service = signing_service_api_client.list(name=service_name).results[0] + signing_service = pulpcore_bindings.SigningServicesApi.list(name=service_name).results[0] assert signing_service.pubkey_fingerprint == fingerprint assert signing_service.public_key == gpg.export_keys(keyid) diff --git a/requirements.txt b/requirements.txt index 88705bc23..ad8aad87c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # All things django and asyncio are deliberately left to pulpcore # Example transitive requirements: asgiref, asyncio, aiohttp -pulpcore>=3.49.0,<3.55 +pulpcore>=3.49.0,<3.70 python-debian>=0.1.44,<0.2.0 python-gnupg>=0.5,<0.6 jsonschema>=4.6,<5.0