From b72ceaa0f9c3d1e2a83da32b97b7f952df631691 Mon Sep 17 00:00:00 2001 From: Gerrod Date: Thu, 27 Jun 2024 10:03:41 -0400 Subject: [PATCH] Merge pull request #692 from gerrod3/package-type-filter-fix Fix package_types filter breaking others (cherry picked from commit a37d040b901d70a527c208fab9edef486039a205) --- CHANGES/691.bugfix | 1 + pulp_python/app/tasks/sync.py | 2 +- pulp_python/tests/functional/api/test_sync.py | 17 +++++++++++++++++ pulp_python/tests/functional/constants.py | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 CHANGES/691.bugfix diff --git a/CHANGES/691.bugfix b/CHANGES/691.bugfix new file mode 100644 index 00000000..448af729 --- /dev/null +++ b/CHANGES/691.bugfix @@ -0,0 +1 @@ +Fixed the `package_types` filter breaking other remote filters. diff --git a/pulp_python/app/tasks/sync.py b/pulp_python/app/tasks/sync.py index 3af26a59..1293c613 100644 --- a/pulp_python/app/tasks/sync.py +++ b/pulp_python/app/tasks/sync.py @@ -83,7 +83,7 @@ def create_bandersnatch_config(remote): config["plugins"]["enabled"] += "prerelease_release\n" if remote.package_types: rrfm = "regex_release_file_metadata" - config["plugins"]["enabled"] += rrfm + config["plugins"]["enabled"] += f"{rrfm}\n" if not config.has_section(rrfm): config.add_section(rrfm) config[rrfm]["any:release_file.packagetype"] = "\n".join(remote.package_types) diff --git a/pulp_python/tests/functional/api/test_sync.py b/pulp_python/tests/functional/api/test_sync.py index b64e8404..79a07b0c 100644 --- a/pulp_python/tests/functional/api/test_sync.py +++ b/pulp_python/tests/functional/api/test_sync.py @@ -641,6 +641,23 @@ def test_no_platform_sync(self): ) +@pytest.mark.parallel +def test_sync_multiple_filters( + python_repo_with_sync, python_remote_factory, python_content_summary +): + """Tests sync with multiple filters.""" + remote = python_remote_factory( + includes=PYTHON_LG_PROJECT_SPECIFIER, + package_types=["bdist_wheel"], + keep_latest_packages=1, + prereleases=False + ) + repo = python_repo_with_sync(remote) + + summary = python_content_summary(repository_version=repo.latest_version_href) + assert summary.present["python.python"]["count"] == PYTHON_LG_FIXTURE_COUNTS["multi"] + + @pytest.mark.parallel def test_proxy_sync( python_repo, diff --git a/pulp_python/tests/functional/constants.py b/pulp_python/tests/functional/constants.py index d37c8f07..5592dc87 100644 --- a/pulp_python/tests/functional/constants.py +++ b/pulp_python/tests/functional/constants.py @@ -155,6 +155,7 @@ "latest_3": 49, "sdist": 27, "bdist_wheel": 63, + "multi": 33, # keep_latest=1, package_types="bdist_wheel", prereleases=False } DJANGO_LATEST_3 = 4 # latest version has 2 dists, each other has 1