pulp_2_tests.tests.rpm.api_v2.test_sync_publish

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

Tests that sync and publish RPM repositories.

For information on repository sync and publish operations, see Synchronization and Publication.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.ChangeFeedTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Sync a repository, change its feed, and sync it again.

Specifically, the test case procedure is as follows:

  1. Create three repositories — call them A, B and C.
  2. Populate repository A and B with identical content, and publish them.
  3. Set C’s feed to repository A. Sync and publish repository C.
  4. Set C’s feed to repository B. Sync and publish repository C.
  5. Download an RPM from repository C.

The entire procedure should succeed. This test case targets Pulp #1922.

create_sync_publish_repo(body)

Create, sync and publish a repository.

Also, schedule the repository for deletion.

Parameters:body – A dict of information to use when creating the repository.
Returns:A detailed dict of information about the repository.
get_feed(repo)

Build the feed to an RPM repository’s distributor.

classmethod setUpClass()

Set config and client used by each test case.

test_all()

Sync a repository, change its feed, and sync it again.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.ErrorReportTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test whether an error report contains sufficient information.

run_task(repo_body)

Implement the logic described by each of the test* methods.

test_invalid_feed_error_message()

Test whether an error report contains sufficient information.

Do the following:

  1. Create and sync a repository using an invalid feed URL.
  2. Get a reference to the task containing error information.
  3. Assert that:
test_missing_filelists_error_message()

Test whether an error report contains sufficient information.

Do the following:

  1. Create and sync a repository using a missing filelist feed URL.
  2. Get a reference to the task containing error information.
  3. Assert that:
    • The error description is sufficiently verbose. See Pulp #4262
    • The traceback is non-null. See Pulp #1455.
class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.NonExistentRepoTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Perform actions on non-existent repositories.

This test targets Pulp Smash #157.

setUp()

Set variables used by each test case.

test_publish()

Publish a non-existent repository.

test_sync()

Sync a non-existent repository.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.PulpStreamerDecodeTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test pulp_streamer stream decodes responses.

This test targets the following issue:

Pulp #4603

The problem occurs only for content that can be compressed with gzip. Nectar, the download library inside pulp workers, advertises that it can receive content compressed using gzip. When the worker asks the web server for one of the distribution files, the web server responds with the files compressed using gzip. The worker uses nectar to decode the file and then writes it to disk. The same nectar code is used in the streamer. When the streamer is passing along the file, it is passing it along in the decoded form. When the worker gets this data during the deferred_download task or the download task, it is attempting to decompress it, but the streamer had already done that.

Verify that the content being published is compressed.

Steps:

  1. Create, sync and publish a repo on_demand using a kickstart directory containing a compressed file like vmlinuz.
  2. Create a temporary directory where the compressed file will be downloaded.
  3. Run curl to download the vmlinuz file with gzip encoding.
  4. Verify return code failures from curl.
  5. Run gunzip on the downloaded file.
  6. Verify no stdout, stderr, or return code failures from gunzip.
test_pulp_streamer_encoding()

Test pulp_streamer stream decodes responses.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncDrpmRepoTestCase(methodName='runTest')

Bases: pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncRepoBaseTestCase

Test one can create and sync an RPM repository with an DRPM feed.

static get_feed_url()

Return an DRPM repository feed URL.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncInParallelTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Sync several repositories in parallel.

test_all()

Sync several repositories in parallel.

Specifically, do the following:

  1. Create several repositories. Ensure each repository has an importer whose feed references a repository containing one or more errata.
  2. Sync each repository. Assert each sync completed successfully.
  3. Get a summary of information about each repository, and assert the repo has an appropriate number of errata.

Pulp #2721 describes how a race condition can occur when multiple repos with identical errata are synced at the same time. This test case attempts to trigger that race condition.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncInvalidMetadataTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Sync various repositories with invalid metadata.

When a repository with invalid metadata is encountered, Pulp should gracefully fail. This test case targets Pulp #1287.

do_test(feed_url)

Implement the logic described by each of the test* methods.

classmethod tearDownClass()

Delete orphan content units.

test_incomplete_filelists()

Sync a repository with an incomplete filelists.xml file.

test_incomplete_other()

Sync a repository with an incomplete other.xml file.

test_missing_filelists()

Sync a repository that’s missing its filelists.xml file.

test_missing_other()

Sync a repository that’s missing its other.xml file.

test_missing_primary()

Sync a repository that’s missing its primary.xml file.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncRepoBaseTestCase(methodName='runTest')

Bases: unittest.case.TestCase

A parent class for repository syncronization test cases.

get_feed_url() should be overridden by concrete child classes. This method’s response is used when setting the repository’s importer feed URL.

static get_feed_url()

Return an RPM repository feed URL. Should be overridden.

Raises:NotImplementedError if not overridden by a child class.
classmethod setUpClass()

Create an RPM repository with a valid feed and sync it.

classmethod tearDownClass()

Clean resources.

test_start_sync_code()

Assert the call to sync a repository returns an HTTP 202.

test_task_progress_report()

Assert no task’s progress report contains error details.

Other assertions about the final state of each task are handled by the client’s response handler. (For more information, see the source of pulp_smash.api.safe_handler.)

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncRpmRepoTestCase(methodName='runTest')

Bases: pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncRepoBaseTestCase

Test one can create and sync an RPM repository with an RPM feed.

static get_feed_url()

Return an RPM repository feed URL.

test_no_change_in_second_sync()

Verify that syncing a second time has no changes.

If the repository have not changed then Pulp must state that anything was changed when doing a second sync.

test_unit_count_on_repo()

Verify that the sync added the correct number of units to the repo.

Read the repository and examine its content_unit_counts attribute. Compare these attributes to metadata from the remote repository. Expected values are currently hard-coded into this test.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncSha512RPMPackageTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test whether user can sync RPM repo with sha512 checksum.

test_all()

Test whether RPM repo with sha512 checksum is synced correctly.

Do the following:

  1. Create a repo pointing to RPM_SHA_512_FEED_URL.
  2. Sync the repo and verify whether it is synced correctly.
  3. Auto Publish the repo and check whether the repomd.xml contains all checksum objects of type sha512.

This test targets Pulp Plan #4007.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncSrpmRepoTestCase(methodName='runTest')

Bases: pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncRepoBaseTestCase

Test one can create and sync an RPM repository with an SRPM feed.

static get_feed_url()

Return an SRPM repository feed URL.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.SyncZchunkRepoSkipTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Sync feed with zchunks and ensure no zchunk units exist.

A new compression type for repodata exists in Fedora 30 called zchunks. These can be created with patches made to createrepo_c --zck.

Pulp 2 will ignore this repodata archive type to preserve the quality of the existing data. At the time of writing this test, zchunk data is in addition to standard repodata. There are currently no cases of repodata only containing zchunk archives.

For the scope of this test, units are checked in the published location. This prevents finding duplicate units from other repositories outside the scope of the test while still testing the logic the units were not synced.

This test targets the following issues:

Pulp #4529 Pulp #4530

Steps:

  1. Create a repo point to a zchunk feed. Synch and publish the repo.
  2. Assert no published with the .zck extension.
  3. Assert all other units with the repo exist.
test_zchunk_sync()

Sync a repo and verify Pulp 2 does not sync .zck data.

class pulp_2_tests.tests.rpm.api_v2.test_sync_publish.YumMetadataSymlinkTesCase(methodName='runTest')

Bases: unittest.case.TestCase

Yum metadata symlink test case.

This test targets the following issues:

It does the following:

  1. Sync and publish a repository with yum metadata.
  2. Verify that the published yum metadata - productid, is not a symlink.
find_productid(verify_simlink, path)

Find productid given a path.

classmethod setUpClass()

Create class-wide variable.

Test broken symlinks.