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

Add a test for syncing repos with zstd-compressed metadata #3322

Merged
merged 1 commit into from
Nov 24, 2023
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
34 changes: 15 additions & 19 deletions pulp_rpm/tests/functional/api/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
RPM_MODULEMD_DEFAULTS_DATA,
RPM_MODULEMD_OBSOLETES_DATA,
RPM_MODULEMDS_DATA,
RPM_ZSTD_METADATA_FIXTURE_URL,
)
from pulp_rpm.tests.functional.utils import gen_rpm_remote
from pulp_rpm.tests.functional.utils import set_up_module as setUpModule # noqa:F401
Expand All @@ -79,37 +80,32 @@

@pytest.mark.parallel
def test_sync(init_and_sync):
"""Sync repositories with the rpm plugin.

In order to sync a repository a remote has to be associated within
this repository. When a repository is created this version field is set
as version '0'. After a sync the repository version is updated.

Do the following:

1. Create a repository, and a remote.
2. Assert that repository version is None.
3. Sync the remote.
4. Assert that repository version is not None.
5. Assert that the correct number of units were added and are present
in the repo.
6. Sync the remote one more time.
7. Assert that repository version is different from the previous one.
8. Assert that the same number of are present and that no units were
added.
Copy link
Contributor Author

@dralley dralley Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all out of date and, frankly, more verbose than it needs to be.

"""
"""Sync repositories with the rpm plugin."""
# Create a remote (default) and empty repository
repository, remote = init_and_sync()

# Assert that it's synced properly
latest_version_href = repository.latest_version_href
assert get_content_summary(repository.to_dict()) == RPM_FIXTURE_SUMMARY
assert get_added_content_summary(repository.to_dict()) == RPM_FIXTURE_SUMMARY

# Sync the same repository again
repository, _ = init_and_sync(repository=repository, remote=remote)

# Assert that the repository has not changed, the latest version stays the same
assert latest_version_href == repository.latest_version_href
assert get_content_summary(repository.to_dict()) == RPM_FIXTURE_SUMMARY


@pytest.mark.parallel
def test_sync_zstd(init_and_sync):
"""Test syncing non-gzip metadata."""
repository, _ = init_and_sync(url=RPM_ZSTD_METADATA_FIXTURE_URL)

assert get_content_summary(repository.to_dict()) == RPM_FIXTURE_SUMMARY
assert get_added_content_summary(repository.to_dict()) == RPM_FIXTURE_SUMMARY


@pytest.mark.parallel
def test_sync_local(init_and_sync, tmpdir):
"""Test syncing from the local filesystem."""
Expand Down
3 changes: 2 additions & 1 deletion pulp_rpm/tests/functional/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
RPM_SINGLE_REQUEST_UPLOAD = urljoin(BASE_PATH, "content/rpm/packages/")

RPM_UNSIGNED_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, "rpm-unsigned/")
"""The URL to a repository with unsigned RPM packages."""

RPM_ZSTD_METADATA_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, "rpm-zstd-metadata/")

RPM_INVALID_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, "rpm-missing-filelists/")

Expand Down
Loading