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

Fix wrong version ordering in x-repo search #1517

Merged
merged 8 commits into from
Aug 14, 2023
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -1523,3 +1523,48 @@ def test_cross_repo_search_index_with_updated_namespace_metadata(
assert cv2.namespace_metadata.company == "Testing Co. redux"
assert cv2.namespace_metadata.description == "hello 2"
assert cv2.namespace_metadata.name == namespace_name


def test_cross_repo_search_semantic_version_ordering(
ansible_distro_api_client,
ansible_repo_api_client,
build_and_upload_collection,
galaxy_v3_default_search_api_client,
gen_object_with_cleanup,
):
"""Make sure collections are properly sorted using the order_by='version' parameter."""
pulp_repo = gen_object_with_cleanup(ansible_repo_api_client, {"name": str(uuid.uuid4())})

gen_object_with_cleanup(
ansible_distro_api_client,
{
"name": pulp_repo.name,
"base_path": pulp_repo.name,
"repository": pulp_repo.pulp_href,
},
)

versions = [
"2.0.0",
"1.22.2",
"1.22.1",
"1.22.1-pre",
"1.22.1-dev",
"1.22.1-rc",
"1.22.1-beta",
"1.22.1-alpha",
"1.1.0",
"1.0.1",
"1.0.0",
]

for version in versions:
build_and_upload_collection(ansible_repo=pulp_repo, config={"version": version})

resp = galaxy_v3_default_search_api_client.list(limit=1000, order_by=["version"])

built_collection_versions = [col.collection_version.version for col in resp.data]

versions.sort(key=Version)
jerabekjiri marked this conversation as resolved.
Show resolved Hide resolved

assert versions == built_collection_versions
jerabekjiri marked this conversation as resolved.
Show resolved Hide resolved
Loading