pulp_2_tests.tests.rpm.api_v2.test_repository_layout

Location: Pulp 2 TestsTestspulp_2_tests.tests.rpm.api_v2.test_repository_layout

Tests for the published repository layout.

Starting with Pulp 2.12, YUM distributor must publish repositories using the layout where the packages are published to into Packages/<first_letter> where <first_letter> is the first letter of a given RPM package. For example, the bear.rpm package will be published into Packages/b/bear.rpm. For more information, see Pulp issue #1976.

Old versions of Pulp uses the old layout where all repository’s packages were published on the root of the repository directory not inside the Packages/<first_letter> subdirectory.

class pulp_2_tests.tests.rpm.api_v2.test_repository_layout.RepositoryLayoutTestCase(*args, **kwargs)

Bases: pulp_smash.pulp2.utils.BaseAPITestCase

Test the YUM distributor publishing repository layout.

test_all()

Do not use the packages_directory option.

Create a distributor with default options, and use it to publish the repository. Verify packages end up in the current directory, relative to the published repository’s root. (This same directory contains the repodata directory, and it may be changed by setting the distributor’s relative_url.)

pulp_2_tests.tests.rpm.api_v2.test_repository_layout.get_file_hrefs(repomd_xml)

Return the href of each file in a repomd.xml file.

Parameters:repomd_xml – An xml.etree.ElementTree object representing the root of a repomd.xml document.
Returns:An iterable of hrefs, with each href as a string.
pulp_2_tests.tests.rpm.api_v2.test_repository_layout.get_package_hrefs(primary_xml)

Return the href of each package in a primary.xml file.

Parameters:primary_xml – An xml.etree.ElementTree object representing the root of a primary.xml document.
Returns:An iterable of hrefs, with each href as a string.
pulp_2_tests.tests.rpm.api_v2.test_repository_layout.get_parse_repodata_primary_xml(cfg, distributor)

Fetch, decompress, parse and return a repodata/…primary.xml.gz file.

Parameters:
  • cfg – Information about the Pulp deployment being targeted.
  • distributor – Information about a distributor. It should be a dict containing at least {'config': {'relative_url': …}}.
Returns:

An xml.etree.ElementTree object.

pulp_2_tests.tests.rpm.api_v2.test_repository_layout.get_parse_repodata_xml(cfg, distributor, file_path)

Fetch, parse and return an XML file from a repodata directory.

Parameters:
  • cfg – Information about the Pulp deployment being targeted.
  • distributor – Information about a distributor. It should be a dict containing at least {'config': {'relative_url': …}}.
  • file_path – The path to an XML file, relative to the distributor’s relative URL. For example: repodata/repomd.xml.
Returns:

The XML document, parsed as an xml.etree.ElementTree object.