pulp_2_tests.tests.puppet.cli.test_sync

Location: Pulp 2 TestsTestspulp_2_tests.tests.puppet.cli.test_sync

Tests that sync Puppet repositories.

class pulp_2_tests.tests.puppet.cli.test_sync.SyncDownloadedContentTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test whether Pulp can associate already-downloaded content with a repo.

Consider the following scenario:

  1. Create a repository with a feed and sync it.
  2. Create a second repository with the same feed and sync it.

When the second repository is synced, Pulp should recognize that the needed content units are already present, and it should associate them with the second repository. However, according to Pulp #1937, Pulp fails to do this, and the second repository will not be populated.

This test case tests Pulp #1937 and the corresponding Pulp Smash issue, Pulp Smash #269.

test_sync_downloaded_content()

Create two repositories with the same feed, and sync them serially.

More specifically, this test creates two puppet repositories with identical feeds, syncs them serially, and verifies that both have equal non-zero content unit counts.

class pulp_2_tests.tests.puppet.cli.test_sync.SyncFromPuppetForgeTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test whether one can sync modules from the Puppet Forge.

According to Pulp #1846, Pulp sometimes fails to sync modules available on the Puppet forge. There is no consistency regarding which modules fail to sync: according to one comment, Pulp only detects 40 modules (of ~1,800), and according to another comment, Pulp syncs 4,089 of 4,128 modules.

How do we test this? The ideal test case is to repeatedly sync the entire Puppet Forge and check for sync failures, until the probability of another random failure is low. This is problematic: we’re abusing the Puppet Forge and extending the test time. A more realistic test is to sync a small number of modules and ensure that no errors occur. This provides much less assurance, but it does at least show that a sync from the Puppet Forge can complete.

pulp_2_tests.tests.puppet.api_v2.test_sync_publish already syncs from the Puppet Forge, but Pulp #1846 specifically uses the CLI.

The end result is a test case that syncs an unknown number of Puppet modules and which provides only minimal assurance that syncs from the Puppet Forge work. Unfortunately, we cannot do better.

test_sync_puppet_forge()

Create a Puppet repository and trigger a sync.

pulp_2_tests.tests.puppet.cli.test_sync.get_num_units_in_repo(cfg, repo_id)

Tell how many puppet modules are in a repository.

Parameters:
  • cfg – Information about the Pulp server being targeted.
  • repo_id – A Puppet repository ID.
Returns:

The number of puppet modules in a repository, as an int.

pulp_2_tests.tests.puppet.cli.test_sync.setUpModule()

Skip this module of tests if appropriate.

See Pulp #2574.