Skip to content

Commit

Permalink
Add a test for syncing repos with zstd-compressed metadata
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
dralley committed Nov 24, 2023
1 parent 103e466 commit 0c4114d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
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.
"""
"""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

0 comments on commit 0c4114d

Please sign in to comment.