Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Uploading RPM with large metadata and testing no exceptions raised
Browse files Browse the repository at this point in the history
This commit verifies whether an rpm file
``constants.RPM_LARGE_METADATA`` can be uploaded into an rpm repo in
pulp without any DocumentTooLarge error raised.

refer [#723](https://pulp.plan.io/issues/723)_
Closes #88
  • Loading branch information
ragabala authored and Kersom committed Oct 31, 2018
1 parent 4815960 commit f23f5ed
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pulp_2_tests/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,3 +643,13 @@
Built from :data:`SRPM_UNSIGNED_FEED_URL` and :data:`SRPM`.
"""

PULP_LARGE_RPM_REPO = 'https://repos.fedorapeople.org/pulp/pulp/rpm_large_metadata/'
"""A URL which serves the large rpm files for Pulp."""

RPM_LARGE_METADATA = 'nodejs-babel-preset-es2015-6.6.0-2.el6.noarch.rpm'
"""RPM with filelists size more than 9MB and less than 15 MB."""

RPM_LARGE_METADATA_FEED = urljoin(PULP_LARGE_RPM_REPO,
RPM_LARGE_METADATA)
"""Feed URL for ``RPM_LARGE_METADATA``."""
40 changes: 40 additions & 0 deletions pulp_2_tests/tests/rpm/api_v2/test_upload_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
RPM,
RPM_DATA,
RPM_INVALID_URL,
RPM_LARGE_METADATA,
RPM_LARGE_METADATA_FEED,
RPM_UNSIGNED_URL,
RPM_WITH_VENDOR_DATA,
RPM_WITH_VENDOR_FEED_URL,
Expand All @@ -38,6 +40,7 @@
from pulp_2_tests.tests.rpm.api_v2.utils import (
gen_distributor,
gen_repo,
get_rpm_published_path,
get_unit,
)
from pulp_2_tests.tests.rpm.utils import check_issue_2620, check_issue_3104
Expand Down Expand Up @@ -520,3 +523,40 @@ def test_all(self):
# Verify that the repository contains no RPMs
rpm = search_units(cfg, repo, {'type_ids': ('rpm',)})
self.assertEqual(len(rpm), 0)


class UploadLargeMetadataRPM(unittest.TestCase):
"""Test that upload of RPM with larger filelists dosen't throw error."""

def test_all(self):
"""Verify ``pulp_2_tests.constants.RPM_LARGE_METADATA`` rpm file can be uploaded.
Specifically, this method does the following:
1. Create an RPM repo.
2. Verify whether the file
``pulp_2_tests.constants.RPM_LARGE_METADATA`` can be uploaded
into the repo without errors.
This test targets:
* `Pulp #723 <https://pulp.plan.io/issues/723>`_
* `Pulp-2-Tests #88 <https://github.com/PulpQE/Pulp-2-Tests/issues/88>`_
"""
cfg = config.get_config()
client = api.Client(cfg, api.json_handler)
body = gen_repo(
distributors=[gen_distributor()]
)
repo = client.post(REPOSITORY_PATH, body)
self.addCleanup(client.delete, repo['_href'])
rpm = utils.http_get(RPM_LARGE_METADATA_FEED)
upload_import_unit(cfg, rpm, {
'unit_type_id': 'rpm',
}, repo)
repo = client.get(repo['_href'], params={'details': True})
publish_repo(cfg, repo)
rpm_path = get_rpm_published_path(cfg, repo, RPM_LARGE_METADATA)

# Check whether the rpm is uploaded published.
self.assertIn(RPM_LARGE_METADATA, rpm_path, rpm_path)
11 changes: 11 additions & 0 deletions pulp_2_tests/tests/rpm/api_v2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,3 +495,14 @@ def get_rpm_names_versions(cfg, repo):
for versions in names_versions.values():
versions.sort(key=Version)
return names_versions


def get_rpm_published_path(cfg, repo, rpm_name):
"""Return the absolute path to ``pulp_2_tests.constants.RPM``."""
_path = '/var/lib/pulp/published/yum/https/repos/{}'.format(
repo['distributors'][0]['config']['relative_url']
)
return cli.Client(cfg).run(
'find {} -name'.format(_path)
.split() + [rpm_name]
).stdout.strip()

0 comments on commit f23f5ed

Please sign in to comment.