Skip to content

Commit

Permalink
Make the plugin compatible with pulpcore v3.55
Browse files Browse the repository at this point in the history
closes #1681
  • Loading branch information
lubosmj committed Jul 2, 2024
1 parent 2d7b93c commit a832b9f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGES/1681.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Made the plugin compatible with pulpcore v3.55.
4 changes: 2 additions & 2 deletions pulp_container/tests/functional/api/test_build_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def containerfile_name():


def test_build_image(
artifacts_api_client,
pulpcore_bindings,
container_repository_api,
container_distribution_api,
gen_object_with_cleanup,
Expand All @@ -41,7 +41,7 @@ def test_build_image(
with NamedTemporaryFile() as text_file:
text_file.write(b"some text")
text_file.flush()
artifact = gen_object_with_cleanup(artifacts_api_client, text_file.name)
artifact = gen_object_with_cleanup(pulpcore_bindings.ArtifactsApi, text_file.name)

repository = gen_object_with_cleanup(
container_repository_api, ContainerContainerRepository(**gen_repo())
Expand Down
30 changes: 12 additions & 18 deletions pulp_container/tests/functional/api/test_pulpimportexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ def test_import_export_standard(
container_repository_api,
container_repository_version_api,
container_manifest_api,
exporters_pulp_api_client,
exporters_pulp_exports_api_client,
importers_pulp_api_client,
importers_pulp_imports_api_client,
pulpcore_bindings,
gen_object_with_cleanup,
has_pulp_plugin,
):
Expand All @@ -48,11 +45,11 @@ def test_import_export_standard(
"path": f"/tmp/{uuid.uuid4()}/",
"repositories": [repository.pulp_href],
}
exporter = gen_object_with_cleanup(exporters_pulp_api_client, body)
exporter = gen_object_with_cleanup(pulpcore_bindings.ExportersPulpApi, body)

export_response = exporters_pulp_exports_api_client.create(exporter.pulp_href, {})
export_response = pulpcore_bindings.ExportersPulpExportsApi.create(exporter.pulp_href, {})
export_href = monitor_task(export_response.task).created_resources[0]
export = exporters_pulp_exports_api_client.read(export_href)
export = pulpcore_bindings.ExportersPulpExportsApi.read(export_href)

# Clean the old repository out
monitor_task(container_repository_version_api.delete(repository.latest_version_href).task)
Expand All @@ -65,14 +62,14 @@ def test_import_export_standard(
"name": str(uuid.uuid4()),
"repo_mapping": {repository.name: import_repository.name},
}
importer = gen_object_with_cleanup(importers_pulp_api_client, body)
importer = gen_object_with_cleanup(pulpcore_bindings.ImportersPulpApi, body)

if has_pulp_plugin("core", min="3.36.0"):
filenames = [f for f in list(export.output_file_info.keys()) if f.endswith(".tar")]
else:
filenames = [f for f in list(export.output_file_info.keys()) if f.endswith("tar.gz")]

import_response = importers_pulp_imports_api_client.create(
import_response = pulpcore_bindings.ImportersPulpImportsApi.create(
importer.pulp_href, {"path": filenames[0]}
)
if hasattr(import_response, "task_group"):
Expand Down Expand Up @@ -111,10 +108,7 @@ def test_import_export_create_repositories(
container_repository_api,
container_tag_api,
container_manifest_api,
exporters_pulp_api_client,
exporters_pulp_exports_api_client,
importers_pulp_api_client,
importers_pulp_imports_api_client,
pulpcore_bindings,
gen_object_with_cleanup,
has_pulp_plugin,
):
Expand All @@ -135,24 +129,24 @@ def test_import_export_create_repositories(
"path": f"/tmp/{uuid.uuid4()}/",
"repositories": [distribution.repository],
}
exporter = gen_object_with_cleanup(exporters_pulp_api_client, body)
export_response = exporters_pulp_exports_api_client.create(exporter.pulp_href, {})
exporter = gen_object_with_cleanup(pulpcore_bindings.ExportersPulpApi, body)
export_response = pulpcore_bindings.ExportersPulpExportsApi.create(exporter.pulp_href, {})
export_href = monitor_task(export_response.task).created_resources[0]
export = exporters_pulp_exports_api_client.read(export_href)
export = pulpcore_bindings.ExportersPulpExportsApi.read(export_href)

# Clean the old repository out
monitor_task(container_distribution_api.delete(distribution.pulp_href).task)
delete_orphans()

body = {"name": str(uuid.uuid4())}
importer = gen_object_with_cleanup(importers_pulp_api_client, body)
importer = gen_object_with_cleanup(pulpcore_bindings.ImportersPulpApi, body)

if has_pulp_plugin("core", min="3.36.0"):
filenames = [f for f in list(export.output_file_info.keys()) if f.endswith(".tar")]
else:
filenames = [f for f in list(export.output_file_info.keys()) if f.endswith("tar.gz")]

import_response = importers_pulp_imports_api_client.create(
import_response = pulpcore_bindings.ImportersPulpImportsApi.create(
importer.pulp_href, {"path": filenames[0], "create_repositories": True}
)
if hasattr(import_response, "task_group"):
Expand Down
6 changes: 3 additions & 3 deletions pulp_container/tests/functional/api/test_sync.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests that sync container plugin repositories."""

import pytest
from pulpcore.tests.functional import PulpTaskError
from pulpcore.tests.functional.utils import PulpTaskError

from pulp_container.tests.functional.constants import PULP_FIXTURE_1, PULP_LABELED_FIXTURE

Expand Down Expand Up @@ -87,11 +87,11 @@ def test_sync_reclaim_resync(
container_remote,
container_sync,
monitor_task,
repositories_reclaim_space_api_client,
pulpcore_bindings,
):
"""Check if re-syncing the content after the reclamation ends with no error."""
container_sync(container_repo, container_remote)
monitor_task(repositories_reclaim_space_api_client.reclaim({"repo_hrefs": ["*"]}).task)
monitor_task(pulpcore_bindings.RepositoriesReclaimSpaceApi.reclaim({"repo_hrefs": ["*"]}).task)
container_sync(container_repo, container_remote)


Expand Down
4 changes: 2 additions & 2 deletions pulp_container/tests/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ def signing_script_filename(signing_gpg_homedir_path):

@pytest.fixture
def container_signing_service(
pulpcore_bindings,
signing_gpg_metadata,
signing_script_filename,
signing_service_api_client,
):
"""A fixture for a signing service."""
st = os.stat(signing_script_filename)
Expand All @@ -284,7 +284,7 @@ def container_signing_service(

subprocess.check_output(cmd)

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,3 +1,3 @@
jsonschema>=4.4,<4.23
pulpcore>=3.49.0,<3.55
pulpcore>=3.49.0,<3.70
pyjwt[crypto]>=2.4,<2.9

0 comments on commit a832b9f

Please sign in to comment.