pulp_smash.tests.rpm.api_v2.test_updateinfo

Location: Pulp SmashAPI Documentationpulp_smash.tests.rpm.api_v2.test_updateinfo

Test the updateinfo.xml files published by Pulp’s yum distributor.

The purpose of an updateinfo.xml file is to document the errata (i.e. maintenance patches) provided by a repository. For an overview of the structure and contents of such a file, see openSUSE:Standards Rpm Metadata UpdateInfo. Beware that yum and dnf do not adhere to the openSUSE standards. We link to their standard anyway because it’s easier to understand than yum or dnf’s source code. (!)

One discrepancy is in the schema for the <pkglist> element. According to the yum source code, it has the following structure:

<!ELEMENT pkglist (collection+)>
<!ELEMENT collection (name?, package+)>
    <!ATTLIST collection short CDATA #IMPLIED>
    <!ATTLIST collection name CDATA #IMPLIED>
<!ELEMENT name (#PCDATA)>

Here’s a concrete example of what that might look like:

<pkglist>
    <collection name="…" short="…">
        <name></name>
        <package></package>
        <package></package>
    </collection>
</pkglist>

yum (and, therefore, dnf) allows a <collection> element to have “name” and “short” attributes. openSUSE does not.

class pulp_smash.tests.rpm.api_v2.test_updateinfo.CleanUpTestCase(methodName='runTest')

Test whether old updateinfo.xml files are cleaned up.

Do the following:

  1. Create, populate and publish a repository. Verify that an updateinfo.xml file is present and can be downloaded.
  2. Add an additional content unit to the repository, and publish it again. Verify that the updateinfo.xml file created by the first publish is no longer available, and that a new updateinfo.xml file is available.

This procedure targets Pulp #2096. Note that the second publish must be an incremental publish.

get_updateinfo_xml_href()

Return the path to the updateinfo.xml file.

classmethod setUpClass()

Create and sync a repository.

classmethod tearDownClass()

Remove the created repository and any orphans.

test_01_first_publish()

Populate and publish the repository.

test_02_second_publish()

Add an additional content unit and publish the repository again.

class pulp_smash.tests.rpm.api_v2.test_updateinfo.PkglistsTestCase(methodName='runTest')

Sync a repository whose updateinfo file has multiple pkglist sections.

This test case targets Pulp #2227.

test_all()

Sync a repo whose updateinfo file has multiple pkglist sections.

Specifically, do the following:

  1. Create, sync and publish an RPM repository whose feed is set to pulp_smash.constants.RPM_PKGLISTS_UPDATEINFO_FEED_URL.
  2. Fetch and parse the published repository’s updateinfo.xml file.

Verify that the updateinfo.xml file has three packages whose <filename> elements have the following text:

  • penguin-0.9.1-1.noarch.rpm
  • shark-0.1-1.noarch.rpm
  • walrus-5.21-1.noarch.rpm

Note that Pulp is free to change the structure of a source repository at will. For example, the source repository has three <collection> elements, the published repository can have one, two or three <collection> elements. Assertions are not made about these details.

class pulp_smash.tests.rpm.api_v2.test_updateinfo.UpdateInfoTestCase(methodName='runTest')

Tests to ensure updateinfo.xml can be created and is valid.

classmethod setUpClass()

Create, populate and publish a repository.

More specifically, do the following:

  1. Create an RPM repository with a distributor.
  2. Populate the repository with an RPM and two errata, where one erratum references the RPM, and the other does not.
  3. Publish the repository Fetch and parse its updateinfo.xml file.
test_erratum()

Assert the erratum generated by Pulp is correct.

Walk through each top-level element of the erratum which was generated during this test case’s set-up and uploaded to Pulp. For each element, verify that the updateinfo.xml file generated by Pulp has a corresponding entry. Each of the verify_* methods on this test case implement the test logic for a single element.

test_one_task_per_import()

Assert only one task is spawned per erratum upload.

test_reboot_not_suggested()

Assert the update info tree does not suggest a spurious reboot.

The errata uploaded by this test case do not suggest that a reboot be applied. As a result, the relevant <update> element in the updateinfo.xml file should not have a <reboot_suggested> tag. Verify that this is so. See Pulp #2032.

Note

In previous versions of Pulp, if no reboot should be applied, a <reboot_suggested>False</reboot_suggested> element would be present. See Pulp #1782.

test_tasks_result()

Assert each task’s result success flag (if present) is true.

This test assumes test_one_task_per_import() passes.

test_tasks_state()

Assert each task’s state is “finished”.

This test assumes test_one_task_per_import() passes.

test_update_elements()

Assert there is one “update” element in updateinfo.xml.

test_updates_element()

Assert updateinfo.xml has a root element named updates.

verify_description(erratum, update_element)

Verify erratum and update_element have same description.

verify_id(erratum, update_element)

Verify erratum and update_element have the same id.

verify_issued(erratum, update_element)

Verify erratum and update_element have the same issued.

verify_pkglist(erratum, update_element)

Verify erratum and update_element have the same pkglist.

verify_references(erratum, update_element)

Verify erratum and update_element have same references.

verify_solution(erratum, update_element)

Verify erratum and update_element have the same solution.

verify_status(erratum, update_element)

Verify erratum and update_element have the same status.

verify_title(erratum, update_element)

Verify erratum and update_element have the same title.

verify_type(erratum, update_element)

Verify erratum and update_element have the same type.

verify_version(erratum, update_element)

Verify erratum and update_element have the same version.

class pulp_smash.tests.rpm.api_v2.test_updateinfo.UpdateRepoTestCase(methodName='runTest')

Verify updateinfo.xml changes as its repo changes.

classmethod setUpClass()

Create an RPM repository with a feed and distributor.

test_01_sync_publish()

Sync and publish the repository.

When executed, this test method will fetch updateinfo.xml and verify that:

test_02_unassociate_publish()

Unassociate a content unit and publish the repository.

Fetch updateinfo.xml. Verify that an <update> with an <id> of pulp_smash.constants.RPM_ERRATUM_ID is not present.

pulp_smash.tests.rpm.api_v2.test_updateinfo.setUpModule()

Possibly skip the tests in this module.

Skip tests if Pulp #2277 affects us.