Skip to content
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

[PULP-235] Bump minor version #6138

Merged
merged 4 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/update_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ jobs:
with:
fetch-depth: 0
path: "pulpcore"
ref: "3.68"
ref: "3.69"

- name: "Run update"
working-directory: "pulpcore"
Expand All @@ -242,21 +242,21 @@ jobs:

- name: "Create Pull Request for CI files"
uses: "peter-evans/create-pull-request@v6"
id: "create_pr_3_68"
id: "create_pr_3_69"
with:
token: "${{ secrets.RELEASE_TOKEN }}"
path: "pulpcore"
committer: "pulpbot <[email protected]>"
author: "pulpbot <[email protected]>"
title: "Update CI files for branch 3.68"
branch: "update-ci/3.68"
base: "3.68"
title: "Update CI files for branch 3.69"
branch: "update-ci/3.69"
base: "3.69"
delete-branch: true
- name: "Mark PR automerge"
working-directory: "pulpcore"
run: |
gh pr merge --rebase --auto "${{ steps.create_pr_3_68.outputs.pull-request-number }}"
if: "steps.create_pr_3_68.outputs.pull-request-number"
gh pr merge --rebase --auto "${{ steps.create_pr_3_69.outputs.pull-request-number }}"
if: "steps.create_pr_3_69.outputs.pull-request-number"
env:
GH_TOKEN: "${{ secrets.RELEASE_TOKEN }}"
continue-on-error: true
Expand Down
1 change: 0 additions & 1 deletion CHANGES/+core_in_bindings_spec.feature

This file was deleted.

1 change: 0 additions & 1 deletion CHANGES/+created_resource_schema.bugfix

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGES/+python_bindings.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Updated the OpenAPI generator version used to generate python bindings to 7.10.0.
This involves stricter client side validation of api calls when using the bindings.
1 change: 0 additions & 1 deletion CHANGES/+task_error_schema.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion CHANGES/1975.doc

This file was deleted.

1 change: 0 additions & 1 deletion CHANGES/3212.doc

This file was deleted.

3 changes: 0 additions & 3 deletions CHANGES/5012.bugfix

This file was deleted.

4 changes: 0 additions & 4 deletions CHANGES/5725.bugfix

This file was deleted.

2 changes: 0 additions & 2 deletions CHANGES/5937.bugfix

This file was deleted.

2 changes: 0 additions & 2 deletions CHANGES/6053.bugfix

This file was deleted.

7 changes: 0 additions & 7 deletions CHANGES/plugin_api/+expose-json-dict.misc

This file was deleted.

3 changes: 0 additions & 3 deletions CHANGES/plugin_api/+squash_migrations.feature

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion pulp_certguard/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ class PulpCertGuardPluginAppConfig(PulpPluginAppConfig):

name = "pulp_certguard.app"
label = "certguard"
version = "3.69.0.dev"
version = "3.70.0.dev"
python_package_name = "pulpcore"
domain_compatible = True
2 changes: 1 addition & 1 deletion pulp_certguard/tests/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def repository_test_file(
filename.write_bytes(b"test content")
repository = file_repository_factory(autopublish=True)
upload_task = file_bindings.ContentFilesApi.create(
relative_path="test_file", file=filename, repository=repository.pulp_href
relative_path="test_file", file=str(filename), repository=repository.pulp_href
).task
monitor_task(upload_task)
return repository
Expand Down
2 changes: 1 addition & 1 deletion pulp_file/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class PulpFilePluginAppConfig(PulpPluginAppConfig):

name = "pulp_file.app"
label = "file"
version = "3.69.0.dev"
version = "3.70.0.dev"
python_package_name = "pulpcore"
domain_compatible = True
38 changes: 18 additions & 20 deletions pulp_file/tests/functional/api/test_crud_content_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

from pulpcore.tests.functional.utils import PulpTaskError

from pulpcore.client.pulpcore.exceptions import ApiException as coreApiException
from pulpcore.client.pulp_file.exceptions import ApiException


@pytest.mark.parallel
def test_crud_content_unit(file_bindings, random_artifact, gen_object_with_cleanup):
Expand Down Expand Up @@ -184,17 +181,18 @@ def test_cannot_create_repo_version_with_two_relative_paths_the_same(


@pytest.mark.parallel
def test_bad_inputs_to_modify_endpoint(file_bindings, file_repo, needs_pulp_plugin):
needs_pulp_plugin("core", min="3.23.0.dev")

with pytest.raises(ApiException):
file_bindings.RepositoriesFileApi.modify(file_repo.pulp_href, [{}])

with pytest.raises(ApiException):
file_bindings.RepositoriesFileApi.modify(file_repo.pulp_href, {"a": "b"})

with pytest.raises(ApiException):
file_bindings.RepositoriesFileApi.modify(file_repo.pulp_href, ["/content/"])
@pytest.mark.parametrize(
"bad_input",
[
pytest.param([()], id="list_with_empty_dict"),
# Pydantic ignores the superfluous parameters for us.
pytest.param({"a": "b"}, id="dict", marks=pytest.mark.xfail),
pytest.param(["/content/"], id="list"),
],
)
def test_modify_rejects_bad_input(file_bindings, file_repo, bad_input):
with pytest.raises((file_bindings.module.ApiException, ValueError)):
file_bindings.RepositoriesFileApi.modify(file_repo.pulp_href, bad_input)


@pytest.mark.parallel
Expand All @@ -220,10 +218,10 @@ def test_create_file_content_from_chunked_upload(
# Upload the file and generate content
upload = gen_object_with_cleanup(pulpcore_bindings.UploadsApi, {"size": 256})
pulpcore_bindings.UploadsApi.update(
upload_href=upload.pulp_href, file=file_1, content_range="bytes 0-127/256"
upload_href=upload.pulp_href, file=str(file_1), content_range="bytes 0-127/256"
)
pulpcore_bindings.UploadsApi.update(
upload_href=upload.pulp_href, file=file_2, content_range="bytes 128-255/256"
upload_href=upload.pulp_href, file=str(file_2), content_range="bytes 128-255/256"
)
most_recent_path = str(uuid.uuid4())
response = file_bindings.ContentFilesApi.create(
Expand All @@ -233,16 +231,16 @@ def test_create_file_content_from_chunked_upload(
content = file_bindings.ContentFilesApi.read(task.created_resources[0])
assert content.sha256 == expected_digest
# Upload gets deleted if the content gets created
with pytest.raises(coreApiException):
with pytest.raises(pulpcore_bindings.module.ApiException):
pulpcore_bindings.UploadsApi.read(upload.pulp_href)

# Attempt to create a duplicate content by re-using the most recent relative path
upload = gen_object_with_cleanup(pulpcore_bindings.UploadsApi, {"size": 256})
pulpcore_bindings.UploadsApi.update(
upload_href=upload.pulp_href, file=file_1, content_range="bytes 0-127/256"
upload_href=upload.pulp_href, file=str(file_1), content_range="bytes 0-127/256"
)
pulpcore_bindings.UploadsApi.update(
upload_href=upload.pulp_href, file=file_2, content_range="bytes 128-255/256"
upload_href=upload.pulp_href, file=str(file_2), content_range="bytes 128-255/256"
)
response = file_bindings.ContentFilesApi.create(
upload=upload.pulp_href, relative_path=most_recent_path
Expand All @@ -251,7 +249,7 @@ def test_create_file_content_from_chunked_upload(
content = file_bindings.ContentFilesApi.read(task.created_resources[0])
assert content.sha256 == expected_digest
# Upload gets deleted even though no new content got created
with pytest.raises(coreApiException):
with pytest.raises(pulpcore_bindings.module.ApiException):
pulpcore_bindings.UploadsApi.read(upload.pulp_href)


Expand Down
25 changes: 5 additions & 20 deletions pulp_file/tests/functional/api/test_crud_remotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import pytest

from pulpcore.client.pulp_file.exceptions import ApiException


@pytest.mark.parallel
def test_remote_crud_workflow(file_bindings, gen_object_with_cleanup, monitor_task):
Expand All @@ -15,7 +13,7 @@ def test_remote_crud_workflow(file_bindings, gen_object_with_cleanup, monitor_ta
assert remote.url == remote_data["url"]
assert remote.name == remote_data["name"]

with pytest.raises(ApiException) as exc:
with pytest.raises(file_bindings.module.ApiException) as exc:
gen_object_with_cleanup(file_bindings.RemotesFileApi, remote_data)
assert exc.value.status == 400
assert json.loads(exc.value.body) == {"name": ["This field must be unique."]}
Expand All @@ -39,26 +37,13 @@ def test_remote_crud_workflow(file_bindings, gen_object_with_cleanup, monitor_ta
assert remote.url == all_new_remote_data["url"]


@pytest.mark.parallel
def test_create_file_remote_with_invalid_parameter(file_bindings, gen_object_with_cleanup):
unexpected_field_remote_data = {
"name": str(uuid.uuid4()),
"url": "http://example.com",
"foo": "bar",
}

with pytest.raises(ApiException) as exc:
gen_object_with_cleanup(file_bindings.RemotesFileApi, unexpected_field_remote_data)
assert exc.value.status == 400
assert json.loads(exc.value.body) == {"foo": ["Unexpected field"]}


@pytest.mark.parallel
def test_create_file_remote_without_url(file_bindings, gen_object_with_cleanup):
with pytest.raises(ApiException) as exc:
with pytest.raises((file_bindings.module.ApiException, ValueError)) as exc:
gen_object_with_cleanup(file_bindings.RemotesFileApi, {"name": str(uuid.uuid4())})
assert exc.value.status == 400
assert json.loads(exc.value.body) == {"url": ["This field is required."]}
if isinstance(exc.value, file_bindings.module.ApiException):
assert exc.value.status == 400
assert json.loads(exc.value.body) == {"url": ["This field is required."]}


@pytest.mark.parallel
Expand Down
23 changes: 10 additions & 13 deletions pulp_file/tests/functional/api/test_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import json

from pulpcore.app import settings
from pulpcore.client.pulp_file import ApiException
from pulpcore.client.pulpcore import ApiException as CoreApiException
from pulpcore.client.pulpcore import Repair
from pulpcore.tests.functional.utils import generate_iso, download_file


Expand Down Expand Up @@ -45,7 +42,7 @@ def test_object_creation(

# Try to create an object w/ cross domain relations
default_remote = file_remote_factory(manifest_path=basic_manifest_path, policy="immediate")
with pytest.raises(ApiException) as e:
with pytest.raises(file_bindings.ApiException) as e:
repo_body = {"name": str(uuid.uuid4()), "remote": default_remote.pulp_href}
file_bindings.RepositoriesFileApi.create(repo_body, pulp_domain=domain.name)
assert e.value.status == 400
Expand All @@ -54,7 +51,7 @@ def test_object_creation(
"non_field_errors": [f"Objects must all be a part of the {domain_name} domain."]
}

with pytest.raises(ApiException) as e:
with pytest.raises(file_bindings.ApiException) as e:
sync_body = {"remote": default_remote.pulp_href}
file_bindings.RepositoriesFileApi.sync(repo.pulp_href, sync_body)
assert e.value.status == 400
Expand Down Expand Up @@ -115,15 +112,15 @@ def test_artifact_upload(
assert second_artifact.sha256 == file["digest"]

# Test that duplicate artifact can not be uploaded in same domain
with pytest.raises(CoreApiException) as e:
pulpcore_bindings.ArtifactsApi.create(filename, pulp_domain=domain.name)
with pytest.raises(pulpcore_bindings.ApiException) as e:
pulpcore_bindings.ArtifactsApi.create(str(filename), pulp_domain=domain.name)
assert e.value.status == 400
assert json.loads(e.value.body) == {
"non_field_errors": [f"Artifact with sha256 checksum of '{file['digest']}' already exists."]
}

# Show that duplicate artifacts can be uploaded into different domains
dup_artifact = pulpcore_bindings.ArtifactsApi.create(filename, pulp_domain="default")
dup_artifact = pulpcore_bindings.ArtifactsApi.create(str(filename), pulp_domain="default")
assert "default/api/v3/" in dup_artifact.pulp_href
assert dup_artifact.sha256 == second_artifact.sha256

Expand All @@ -148,9 +145,9 @@ def test_content_upload(
file = generate_iso(filename)
relative_path = "1.iso"

task = file_bindings.ContentFilesApi.create(relative_path, file=filename).task
task = file_bindings.ContentFilesApi.create(relative_path, file=str(filename)).task
task2 = file_bindings.ContentFilesApi.create(
relative_path, file=filename, pulp_domain=domain.name
relative_path, file=str(filename), pulp_domain=domain.name
).task
response = monitor_task(task)
default_content = file_bindings.ContentFilesApi.read(response.created_resources[0])
Expand Down Expand Up @@ -230,7 +227,7 @@ def test_content_promotion(

# Test that a repository version repair operation can be run without error
response = file_bindings.RepositoriesFileVersionsApi.repair(
repo.latest_version_href, Repair(verify_checksums=True)
repo.latest_version_href, file_bindings.Repair(verify_checksums=True)
)
results = monitor_task(response.task)
assert results.state == "completed"
Expand Down Expand Up @@ -273,7 +270,7 @@ def test_domain_rbac(pulpcore_bindings, file_bindings, gen_user, gen_object_with
assert repos.count == 1
assert repos.results[0].pulp_href == repo.pulp_href
# Try to create a repository in default domain
with pytest.raises(ApiException) as e:
with pytest.raises(file_bindings.ApiException) as e:
file_bindings.RepositoriesFileApi.create({"name": str(uuid.uuid4())})
assert e.value.status == 403

Expand All @@ -284,7 +281,7 @@ def test_domain_rbac(pulpcore_bindings, file_bindings, gen_user, gen_object_with
repos = file_bindings.RepositoriesFileApi.list()
assert repos.count == 0
# Try to create a repo
with pytest.raises(ApiException) as e:
with pytest.raises(file_bindings.ApiException) as e:
file_bindings.RepositoriesFileApi.create(
{"name": str(uuid.uuid4())}, pulp_domain=domain.name
)
Expand Down
10 changes: 0 additions & 10 deletions pulp_file/tests/functional/api/test_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,6 @@ def test_model_partial_update(file_repository_factory, file_bindings, monitor_ta
assert file_repo.pulp_labels == labels


@pytest.mark.parallel
def test_invalid_label_type(file_repository_factory):
"""Test that label doesn't accept non-dicts"""

with pytest.raises(ApiException) as e_info:
labels = "key_a" # str instead of dict
file_repository_factory(name=str(uuid4()), pulp_labels=labels)
assert e_info.value.status == 400


@pytest.mark.parallel
def test_invalid_labels(file_repository_factory):
"""Test that label keys and values are validated."""
Expand Down
26 changes: 16 additions & 10 deletions pulp_file/tests/functional/api/test_rbac.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import pytest
import uuid

from pulpcore.client.pulp_file import ApiException
from pulpcore.client.pulp_file import AsyncOperationResponse


@pytest.fixture()
def gen_users(gen_user):
Expand All @@ -23,19 +20,28 @@ def _gen_users(role_names=list()):


@pytest.fixture
def try_action(monitor_task):
def try_action(file_bindings, monitor_task):
def _try_action(user, client, action, outcome, *args, **kwargs):
action_api = getattr(client, f"{action}_with_http_info")
try:
with user:
response, status, _ = action_api(*args, **kwargs, _return_http_data_only=False)
if isinstance(response, AsyncOperationResponse):
response = monitor_task(response.task)
except ApiException as e:
response = action_api(*args, **kwargs)
if isinstance(response, tuple):
# old bindings
data, status, _ = response
else:
# new bindings
data = response.data
status_code = response.status_code
if isinstance(data, file_bindings.module.AsyncOperationResponse):
data = monitor_task(data.task)
except file_bindings.module.ApiException as e:
assert e.status == outcome, f"{e}"
else:
assert status == outcome, f"User performed {action} when they shouldn't been able to"
return response
assert (
status_code == outcome
), f"User performed {action} when they shouldn't been able to"
return data

return _try_action

Expand Down
Loading
Loading