Skip to content

Commit

Permalink
Merge pull request #1101 from ATIX-AG/pulpcore-compat-355
Browse files Browse the repository at this point in the history
Raise pulpcore requirement to 3.55+
  • Loading branch information
hstct authored Jun 19, 2024
2 parents 0d484f8 + bad79ff commit b60062b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGES/1100.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Made the plugin compatible with pulpcore 3.55.0+.
6 changes: 3 additions & 3 deletions pulp_deb/tests/functional/api/test_download_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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
33 changes: 14 additions & 19 deletions pulp_deb/tests/functional/api/test_pulpexport_pulpimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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(
Expand Down Expand Up @@ -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

Expand All @@ -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."""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -218,15 +214,15 @@ 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()
importer = deb_importer_factory(import_repos, export_repos)
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:
Expand Down Expand Up @@ -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."""
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pulp_deb/tests/functional/api/test_source_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ 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."""

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
Expand Down
6 changes: 4 additions & 2 deletions pulp_deb/tests/functional/api/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
):
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pulp_deb/tests/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b60062b

Please sign in to comment.