pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor¶
Location: Pulp 2 Tests → Tests → pulp_2_tests.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:
- Create RPM repository with yum and RPM rsync distributors.
- Upload some content units to the repository.
- Publish the repository with the yum distributor.
- 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_2_tests.tests.rpm.api_v2.test_rsync_distributor.AddUnitTestCase(methodName='runTest')¶ Bases:
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor._RsyncDistUtilsMixin,pulp_2_tests.tests.rpm.api_v2.utils.TemporaryUserMixin,unittest.case.TestCaseAdd a content unit to a repo in the middle of several publishes.
When executed, this test case does the following:
- Create a yum repository with a yum and rsync distributor.
- Add some content to the repository.
- Publish the repository with its yum distributor.
- Add additional content to the repository.
- 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.
- Publish the repository with its yum distributor.
- 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_2_tests.tests.rpm.api_v2.test_rsync_distributor.DeleteTestCase(methodName='runTest')¶ Bases:
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor._RsyncDistUtilsMixin,pulp_2_tests.tests.rpm.api_v2.utils.DisableSELinuxMixin,pulp_2_tests.tests.rpm.api_v2.utils.TemporaryUserMixin,unittest.case.TestCaseUse the
deleteRPM rsync distributor option.Do the following:
- Create a repository with a yum distributor and RPM rsync distributor. Add content units to the repository.
- Publish with the yum distributor.
- Publish with the RPM rsync distributor. Verify that the correct files are in the target directory.
- Remove all files from the repository, and publish with the yum distributor.
- Publish with the RPM rsync distributor, with
deleteset to true. Verify that all files are removed from the target directory.
This test targets Pulp #2221.
-
test_all()¶ Use the
deleteRPM rsync distributor option.
-
class
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor.ForceFullTestCase(methodName='runTest')¶ Bases:
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor._RsyncDistUtilsMixin,pulp_2_tests.tests.rpm.api_v2.utils.DisableSELinuxMixin,pulp_2_tests.tests.rpm.api_v2.utils.TemporaryUserMixin,unittest.case.TestCaseUse the
force_fullRPM rsync distributor option.Do the following:
- Create a repository with a yum distributor and RPM rsync distributor. Add content units to the repository.
- Publish with the yum distributor.
- Publish with the RPM rsync distributor. Verify that the correct files are in the target directory.
- 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.)
- Publish with the RPM rsync distributor, with
force_fullset 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_fullRPM rsync distributor option.
-
class
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor.PublishBeforeYumDistTestCase(methodName='runTest')¶ Bases:
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor._RsyncDistUtilsMixin,pulp_2_tests.tests.rpm.api_v2.utils.TemporaryUserMixin,unittest.case.TestCasePublish a repo with the rsync distributor before the yum distributor.
Do the following:
- Create a repository with a yum distributor and rsync distributor.
- Publish with the rpm rsync distributor. Verify that:
- The publish has a result of “skipped.”
- No files are placed on the remote system.
- 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_2_tests.tests.rpm.api_v2.test_rsync_distributor.PublishTwiceTestCase(methodName='runTest')¶ Bases:
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor._RsyncDistUtilsMixin,pulp_2_tests.tests.rpm.api_v2.utils.TemporaryUserMixin,unittest.case.TestCasePublish with a yum and rsync distributor twice.
Do the following when executed:
- Create a yum repository with a yum and rsync distributor.
- Add some content to the repository.
- Publish with the yum and rsync distributor.
- 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_processedfor unit query step inpublish_task.
-
test_all()¶ Publish with a yum and rsync distributor twice.
-
class
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor.RemoteUnitsPathTestCase(methodName='runTest')¶ Bases:
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor._RsyncDistUtilsMixin,pulp_2_tests.tests.rpm.api_v2.utils.DisableSELinuxMixin,pulp_2_tests.tests.rpm.api_v2.utils.TemporaryUserMixin,unittest.case.TestCaseExercise the
remote_units_pathoption.Do the following:
- Create a repository with a yum distributor and RPM rsync distributor,
and ensure that the latter distributor’s
remote_units_pathoption is set to a non-default value (notcontent/units). Add content units to the repository. - Publish with the yum distributor.
- Publish with the RPM rsync distributor. Verify that files are placed in the correct directory.
- Publish with the RPM rsync distributor, with
remote_units_pathpassed as publish option. Verify that files are placed in this directory.
-
test_all()¶ Exercise the
remote_units_pathoption.
- Create a repository with a yum distributor and RPM rsync distributor,
and ensure that the latter distributor’s
-
class
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor.RsyncExtraArgsTestCase(methodName='runTest')¶ Bases:
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor._RsyncDistUtilsMixin,pulp_2_tests.tests.rpm.api_v2.utils.DisableSELinuxMixin,pulp_2_tests.tests.rpm.api_v2.utils.TemporaryUserMixin,unittest.case.TestCaseUse the
rsync_extra_argsRPM rsync distributor option.Do the following:
- Create a repository with a yum distributor and RPM rsync distributor. Add content units to the repository.
- Publish with the yum distributor.
- Publish with the RPM rsync distributor, with
rsync_extra_argsset to['--dry-run'], i.e. no files should actually be copied by rsync. - Verify that no files are in the target directory.
- Publish with the RPM rsync distributor, with
force_fullset to true. Note:force_fullis needed here as Pulp is not aware that the previous calls to rsync did nothing on the target - Verify that all files are present in the target directory.
This test targets Pulp #3317.
-
test_all()¶ Use the
rsync_extra_argsRPM rsync distributor option.
-
class
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor.SymlinkTestCase(methodName='runTest')¶ Bases:
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor._RsyncDistUtilsMixin,pulp_2_tests.tests.rpm.api_v2.utils.DisableSELinuxMixin,pulp_2_tests.tests.rpm.api_v2.utils.TemporaryUserMixin,unittest.case.TestCaseYum metadata symlink test case.
Do the following:
- Create a repository with a yum distributor and RPM rsync distributor.
- Publish with the yum distributor.
- Publish with the RPM rsync distributor.
- Assert that rsync yum metadata present on repodata is not a symlink.
This test targets the following issues:
-
find_productid(verify_simlink, path)¶ Find productid given a path.
-
classmethod
setUpClass()¶ Create class-wide variable.
-
test_broken_symlinks()¶ Assert that the rsync yum metadata is not a symlink.
-
class
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor.VerifyOptionsTestCase(methodName='runTest')¶ Bases:
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor._RsyncDistUtilsMixin,unittest.case.TestCaseTest 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
remoteconfig section.Using the same config for each of the test methods allows the test methods to behave more similarly.
-
tearDown()¶ Verify that the
remoteconfig section hasn’t changed.
-
test_predistributor_id()¶ Pass a bogus ID as the
predistributor_idconfig option.
-
test_remote_units_path()¶ Pass an absolute path to the
remote_units_pathconfig option.
-
test_required_options()¶ Omit each of the required RPM rsync distributor config options.
-
test_root()¶ Pass a relative path to the
rootconfiguration option.
-
test_success()¶ Successfully create an RPM repo with importers and distributors.
-
pulp_2_tests.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 #3313 is not fixed on the target Pulp server, and the target host is running Fedora 27.
-
pulp_2_tests.tests.rpm.api_v2.test_rsync_distributor.tearDownModule()¶ Delete orphan content units.