pulp_smash.tests.rpm.api_v2.test_rsync_distributor

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

Test the functionality of the RPM rsync distributor.

The RPM rsync distributor lets one publish content units to a directory via rsync+ssh. A typical usage of the RPM rsync distributor is as follows:

  1. Create RPM repository with yum and RPM rsync distributors.
  2. Upload some content units to the repository.
  3. Publish the repository with the yum distributor.
  4. Publish the repository with the RPM rsync distributor.

The RPM rsync distributor may not be used by itself. One cannot create an RPM repository with just an RPM rsync distributor; and one cannot publish a repository with the RPM rsync distributor without first publishing with a yum distributor.

For more information on the RPM rsync distributor, see Pulp #1759. As a quick reference, consider a repository with the following abbreviated distributor definitions:

[
    {
        'distributor_type_id': 'rpm_rsync_distributor',
        'config': {
            'remote': {'host': '192.168.100.32', 'root': '/home/myuser'},
            'remote_units_path': 'foo/bar/biz'  # default: 'content/units'
        }
    },
    {
        'distributor_type_id': 'yum_distributor',
        'config': {'relative_url': 'rel-url/'}
    }
]

Following a publish with the yum and rpm rsync distributors, respectively, files will be laid out as follows:

/home/myuser
├── foo
│   └── bar
│       └── biz
│           └── rpm
│               ├── 06
│               │   └── …
│               │       └── dog-4.23-1.noarch.rpm
│               ├── 09
│               │   └── …
│               ┆       └── crow-0.8-1.noarch.rpm
└── rel-url
    ├── bear-4.1-1.noarch.rpm -> ../foo/bar/biz/rpm/a9/…/bear-4.1-1.noarch…
    ├── camel-0.1-1.noarch.rpm -> ../foo/bar/biz/rpm/92/…/camel-0.1-1.noar…
    ┆
class pulp_smash.tests.rpm.api_v2.test_rsync_distributor.AddUnitTestCase(methodName='runTest')

Add a content unit to a repo in the middle of several publishes.

When executed, this test case does the following:

  1. Create a yum repository with a yum and rsync distributor.
  2. Add some content to the repository.
  3. Publish the repository with its yum distributor.
  4. Add additional content to the repository.
  5. Publish the repository with its rsync distributor. This publish shouldn’t distribute the new content unit, as the new content unit wasn’t included in the most recent publish with the yum distributor.
  6. Publish the repository with its yum distributor.
  7. Publish the repository with its rsync distributor. This publish should distribute the new content unit, as the new content unit was included in the most recent publish with the yum distributor.

This test case targets:

test_all()

Add a content unit to a repo in the middle of several publishes.

class pulp_smash.tests.rpm.api_v2.test_rsync_distributor.DeleteTestCase(methodName='runTest')

Use the delete RPM rsync distributor option.

Do the following:

  1. Create a repository with a yum distributor and RPM rsync distributor. Add content units to the repository.
  2. Publish with the yum distributor.
  3. Publish with the RPM rsync distributor. Verify that the correct files are in the target directory.
  4. Remove all files from the repository, and publish with the yum distributor.
  5. Publish with the RPM rsync distributor, with delete set to true. Verify that all files are removed from the target directory.

This test targets Pulp #2221.

test_all()

Use the delete RPM rsync distributor option.

class pulp_smash.tests.rpm.api_v2.test_rsync_distributor.ForceFullTestCase(methodName='runTest')

Use the force_full RPM rsync distributor option.

Do the following:

  1. Create a repository with a yum distributor and RPM rsync distributor. Add content units to the repository.
  2. Publish with the yum distributor.
  3. Publish with the RPM rsync distributor. Verify that the correct files are in the target directory.
  4. Remove all files from the target directory. Publish again, and verify that:
    • The task for publishing has a result of “skipped.”
    • No files are placed in the target directory. (This tests Pulp’s fast-forward logic.)
  5. Publish with the RPM rsync distributor, with force_full set to true. Verify that files are placed in the target directory. Skip this step if Pulp #2202 is not yet fixed.

Additionally, SELinux is temporarily set to “permissive” mode on the target system if Pulp #2199 is not yet fixed.

test_all()

Use the force_full RPM rsync distributor option.

class pulp_smash.tests.rpm.api_v2.test_rsync_distributor.PublishBeforeYumDistTestCase(methodName='runTest')

Publish a repo with the rsync distributor before the yum distributor.

Do the following:

  1. Create a repository with a yum distributor and rsync distributor.
  2. Publish with the rpm rsync distributor. Verify that:
    • The publish has a result of “skipped.”
    • No files are placed on the remote system.
  3. Publish with the rpm rsync distributor again. Perform the same verification steps.

This test targets:

test_all()

Publish the rpm rsync distributor before the yum distributor.

class pulp_smash.tests.rpm.api_v2.test_rsync_distributor.PublishTwiceTestCase(methodName='runTest')

Publish with a yum and rsync distributor twice.

Do the following when executed:

  1. Create a yum repository with a yum and rsync distributor.
  2. Add some content to the repository.
  3. Publish with the yum and rsync distributor.
  4. Publish with the yum and rsync distributor again.

The second publish with the rsync distributor should be a fast-forward publish, as no new units were added to the repository between the first and second publishes. Verify that the first rsync publish is not a fast-foward publish and that the second one is.

This test case targets Pulp #2666.

static get_num_processed(publish_task)

Return num_processed for unit query step in publish_task.

test_all()

Publish with a yum and rsync distributor twice.

class pulp_smash.tests.rpm.api_v2.test_rsync_distributor.RemoteUnitsPathTestCase(methodName='runTest')

Exercise the remote_units_path option.

Do the following:

  1. Create a repository with a yum distributor and RPM rsync distributor, and ensure that the latter distributor’s remote_units_path option is set to a non-default value (not content/units). Add content units to the repository.
  2. Publish with the yum distributor.
  3. Publish with the RPM rsync distributor. Verify that files are placed in the correct directory.
  4. Publish with the RPM rsync distributor, with remote_units_path passed as publish option. Verify that files are placed in this directory.
test_all()

Exercise the remote_units_path option.

class pulp_smash.tests.rpm.api_v2.test_rsync_distributor.VerifyOptionsTestCase(methodName='runTest')

Test Pulp’s verification of RPM rsync distributor configuration options.

Do the following:

  • Repeatedly attempt to create an RPM repository with an importer and pair of distributors. Each time, pass an invalid option, or omit a required option.
  • Create an RPM repository with an importer and pair of distributors. Pass valid configuration options. This demonstrates that creation failures are due to Pulp’s validation logic, not some other factor.
classmethod setUpClass()

Create a value for the rsync distrib’s remote config section.

Using the same config for each of the test methods allows the test methods to behave more similarly.

tearDown()

Verify that the remote config section hasn’t changed.

test_predistributor_id()

Pass a bogus ID as the predistributor_id config option.

test_remote_units_path()

Pass an absolute path to the remote_units_path config option.

test_required_options()

Omit each of the required RPM rsync distributor config options.

test_root()

Pass a relative path to the root configuration option.

test_success()

Successfully create an RPM repo with importers and distributors.

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

Conditionally skip the tests in this module.

Skip the tests in this module if:

  • The RPM plugin is not installed on the target Pulp server.
  • Pulp #1759 is not implemented on the target Pulp server.
pulp_smash.tests.rpm.api_v2.test_rsync_distributor.tearDownModule()

Delete orphan content units.