pulp_2_tests.tests.rpm.api_v2.test_modularity

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

Tests that perform actions over RPM modular repositories.

pulp_2_tests.tests.rpm.api_v2.test_modularity.CONTENT_APPLICABILITY_REPORT_SCHEMA = {'$schema': 'http://json-schema.org/schema#', 'description': 'Derived from: http://docs.pulpproject.org/dev-guide/integration/rest-api/consumer/applicability.html#query-content-applicability', 'items': {'properties': {'applicability': {'properties': {'erratum': {'items': {'type': 'string'}, 'type': 'array'}, 'modulemd': {'items': {'type': 'string'}, 'type': 'array'}, 'rpm': {'items': {'type': 'string'}, 'type': 'array'}}, 'type': 'object'}, 'consumers': {'items': {'type': 'string'}, 'type': 'array'}}, 'type': 'object'}, 'title': 'Content Applicability Report', 'type': 'array'}

A schema for a content applicability report for a consumer.

Schema now includes modulemd profiles:

class pulp_2_tests.tests.rpm.api_v2.test_modularity.CheckIsModularFlagAfterRPMUploadTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Check is_modular flag unit is present after RPM upload.

test_all()

Verify whether the is_modular flag is present in rpm units.

This test does the following:

  1. Upload a modular RPM
  2. Upload a non-modular RPM
  3. Filter the modular and non_modular units using pulp_smash.pulp2.utils.search_units()
  4. Check whether the modular and non_modular units returned by this filter is accurate.

This test case targets:

class pulp_2_tests.tests.rpm.api_v2.test_modularity.CheckIsModularFlagAfterSyncTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Check is_modular flag unit is present after syncing.

test_all()

Verify whether the is_modular flag is present in rpm units.

This test does the following:

  1. Create and sync a modular repository.
  2. Filter the modular and non_modular units using pulp_smash.pulp2.utils.search_units().
  3. Check whether the modular and non_modular units returned by this filter is accurate.

This test case targets:

class pulp_2_tests.tests.rpm.api_v2.test_modularity.CheckModulesYamlTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Check whether modules.yaml is available if appropriate.

static get_modules_elements_repomd(cfg, distributor)

Return a list of elements present inside the repomd.xml.

static get_sha1_vals_file(cfg, filepath)

Return a list containing sha1 checksum of the file and filepath.

static list_repo_data_files(cfg, repo)

Return a list of all the files present inside repodata dir.

classmethod setUpClass()

Create class wide variables.

test_no_modules_yaml_generated_non_modular()

Verify no modules.yaml is generated for non modular content.

This test does the following

  1. Create and sync a non-modular content.
  2. Publish the synced content.
  3. Check whether no modules.yaml is generated for published content.

This test case targets:

test_sha1_modules_yaml()

Verify whether the published modular content has appropriate sha.

This test does the following:

  1. Create and sync a modular content with sha1 checksum.
  2. Publish the synced content
  3. Check whether the modules.yaml is sha1 checked.

This test targets the following:

class pulp_2_tests.tests.rpm.api_v2.test_modularity.CopyModularDefaultsTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test recursive and recursive_conservative flags during copy.

This test targets the following issues:

Recursive or conservative copy of modulemd_defaults should always only copy:

  • 3 modules: duck, kangaroo, walrus

Exercise the use of recursive and ``recursive_conservative.

check_module_total_units(repo)

Test copy of modulemd_defaults in RPM repository.

copy_units(recursive, recursive_conservative, old_dependency=False)

Create two repositories and copy content between them.

classmethod setUpClass()

Create class wide variables.

test_copy_modulemd_defaults()

Test copy of modulemd_defaults in RPM repository.

test_copy_modulemd_defaults_conservative()

Test copy of modulemd_defaults in RPM repository.

test_copy_modulemd_defaults_recursive()

Test copy of modulemd_defaults in RPM repository.

test_copy_modulemd_defaults_recursive_conservative()

Test copy of modulemd_defaults in RPM repository.

class pulp_2_tests.tests.rpm.api_v2.test_modularity.CopyModulesTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test copy of modules, and its artifacts.

This test targets the following issues:

Regressions occurred in copying of any RPMs and modules when other repository modules, modular RPMs, and ursine RPMs would “shadow solve” dependencies. The result would be unexpected modules, module streams, “shadow” modular RPMs, and ursine RPMs being copied.

This test addresses copying modules and verifying the correct count of modules, RPMs and total units copied.

Additional abstracted modules with modular and ursine RPMs were added in pulp-fixtures to be tested in Pulp 2.20 to cover these additional cases.

The following Modules, modular RPMS, and ursine RPMs are used in this test case. Only the explicit counts for each MODULE_FIXTURE should be copied for each.

Modules:

[walrus-0.71]
└── walrus-0.71

[walrus-5.21]
└── walrus-5.21

[duck-4]
└── duck-0.8

[duck-5]
└── duck-0.8

[duck-6]
└── duck-0.8
└── frog-0.1

Dependent RPMs of the provided RPM from walrus-0.71:

walrus-0.71
└── whale
       ├── shark
       └── stork

The modular RPM walrus-5.21 has no modular or ursine RPM dependencies.

The moduar RPM duck-0.8 and frog-0.1 has no modular or ursine RPM dependencies.

Exercise the use of recursive and recursive_conservative with a target repo having no rpms or old_rpm versions for each MODULE_FIXTURE.

check_module_rpm_total_units(repo, module)

Test copy of modulemd in RPM repository.

copy_units(recursive, recursive_conservative, old_rpm, module)

Create two repositories and copy content between them.

classmethod setUpClass()

Create class wide variables.

test_copy_modulemd_nonrecursive_conservative_old_rpm()

Test modular copy using override_config and old RPMs.

test_copy_modulemd_recursive_conservative_no_old_rpm()

Test modular copy using override_config and no old RPMs.

test_copy_modulemd_recursive_conservative_old_rpm()

Test modular copy using override_config and old RPMs.

test_copy_modulemd_recursive_nonconservative_no_old_rpm()

Test modular copy using override_config and no old RPMs.

test_copy_modulemd_recursive_nonconservative_old_rpm()

Test modular copy using override_config and old RPMs.

pulp_2_tests.tests.rpm.api_v2.test_modularity.MODULES_METADATA = mappingproxy({'name': 'walrus', 'stream': '5.21', 'version': '20180704144203', 'context': 'deadbeef', 'arch': 'x86_64'})

Metadata for a Module.

pulp_2_tests.tests.rpm.api_v2.test_modularity.MODULES_METADATA_2 = mappingproxy({'name': 'duck', 'stream': '0', 'version': '201809302113907', 'context': 'deadbeef', 'arch': 'noarch'})

Metadata for another Module.

class pulp_2_tests.tests.rpm.api_v2.test_modularity.ManageModularContentTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Manage modular content tests cases.

This test targets the following issue:

Pulp Smash #1122

create_sync_modular_repo(cleanup=True)

Create a repo with feed pointing to modular data and sync it.

Returns:repo data that is created and synced with modular content.
remove_module_from_repo(repo, criteria)

Remove modules from repo.

classmethod setUpClass()

Create class wide variables.

test_remove_modulemd()

Test sync and remove modular RPM repository.

test_remove_modulemd_defaults()

Test sync and remove modular RPM repository.

test_sync_and_republish_repo()

Test sync and re-publish modular RPM repository.

This test targets the following issue:

Pulp #4477

Steps:

  1. Create a repo pointing to modular feed and sync it.
  2. Get the number of modules present in the repo updateinfo file.
  3. Delete the repo.
  4. Recreate the repo with a different name and sync it.
  5. Get the number of modules present in the repo updateinfo file.
  6. Assert that the number of modules has not increased.
test_sync_publish_repo()

Test sync and publish modular RPM repository.

class pulp_2_tests.tests.rpm.api_v2.test_modularity.ManageModularErrataTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Manage Modular Errata content testcase.

This test targets the following issues:

classmethod setUpClass()

Create class wide variables.

test_collection_field()

Test the collection field in the update info.

This test provides the following:

  1. Check whether all the modules in the published repo contains a collection field.
  2. Check whether the collection field has proper name. The collection name computation is as below.

The collection name is created using the information from fixtures that is stored in a set {<errata-id>:<module-name>}.

First, the set information is used in computing a set collections_from_fixtures that maps the repo_id to the collection-name.

The collection-name set is computed using the logic <repo-id>_<index>_<module-name>. The module name is default and the index is 0 for ursine RPMs.

The set is created using set-comprehension and x-path. After creating the set, it appears as in the example below.

collections_from_fixtures = {
    'RHEA..1' : 'repo_id_1_duck',
    'RHEA..2' : 'repo_id_2_duck',
    'RHEA..3' : 'repo_id_0_default'
}

This set is compared against the collection-name from the published repo’s updateinfo.

test_search_errata()

Test whether updateinfo.xml has errata with modular information.

This test does the following:

  1. Create and sync a repo with RPM_WITH_MODULES_FEED_URL.
  2. Check whether updateinfo.xml has an errata with modules.

3. Check whether search api returns modular content. 3. Check whether search api returns modular erratum content.

This test case targets:

test_sync_publish_update_info()

Test sync,publish of Modular RPM repo and checks the update info.

This testcase reads the updateinfo of the repository that is published and compares that against the updateinfo.xml present in the feed url.

Steps involved:

  1. Create a repository with feed url containing modules.
  2. The repository should have a distributor to publish it.
  3. Once the repository is created, it is synced and published.
  4. Get the updateinfo from the repodata of the published repo.
  5. Compare this against the update_info.xml in the fixtures repo.
test_upload_errata()

Upload errata and check whether it got published in the repo.

This test does the following:

  1. Create and sync a repo with RPM_WITH_MODULES_FEED_URL.
  2. Upload a custom modular erratum to the repo. The custom module erratum is obtained from _get_erratum(). Make sure that the erratum uploaded has a corresponding module in the feed url.
  3. Publish the repo after uploading the custom erratum.
  4. Verify whether the uploaded erratum is present in the published repo and also contains the modules in it.
class pulp_2_tests.tests.rpm.api_v2.test_modularity.ModularApplicabilityTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Perform modular repo applicability generation tasks.

Specifically, do the following:

  1. Create a consumer.
  2. Bind the consumer to the modular repository RPM_WITH_MODULES_FEED_URL.
  3. Create a consumer profile with: * List of RPMs. * List of Modules.
  4. Regenerate applicability for the consumer.
  5. Fetch applicability for the consumer. Verify that the packages are eligible for upgrade.

This test targets the following:

do_test(modules_profile, rpm_profile, erratum=None)

Regenerate and fetch applicability for the given modules and RPMs.

This method does the following:

  1. Create a modular repo.
  2. Create a consumer and bind them to the modular repo.
  3. Create consumer profiles for the passed modules and rpms.
  4. Regenerate and return the fetched applicability.
Parameters:
  • modules_profile – A list of modules for the consumer profile.
  • rpm_profile – A list of RPMs for the consumer profile.
  • erratum – An Erratum to be added to the repo.
Returns:

A dict containing the consumer applicability.

static gen_modular_errata()

Generate and return a modular erratum with RPM.

classmethod setUpClass()

Create class-wide variables.

test_dependent_modules()

Verify dependent modules are made available.

This test does the following:

  1. Bind the consumer with the modular repo.
  2. Update the consumer profile with dependent modules.
  3. Verify that the content is made available for the consumer.
test_erratum_modules()

Verify erratum modules are applicable.

This test does the following:

  1. Bind the consumer with erratum modular repo.
  2. Verify the content is applicable.
test_mixed_rpm()

Verify content is made available for both modular/non modular RPMs.

This test does the following:

  1. Create a consumer profile containing both modular and non modular RPMs.
  2. Bind the consumer to the modular repo.
  3. Verify the content is applicable.
test_modular_rpm()

Verify content is made available if appropriate.

This test does the following:

  1. Create a consumer profile with an RPM version less than the module.
  2. Bind the consumer to the modular repo.
  3. Verify the content is applicable.
test_negative_modular_rpm()

Verify content is not made available when inappropriate.

Do the same as test_modular_rpm(), except that the version should be higher than what is offered by the module.

class pulp_2_tests.tests.rpm.api_v2.test_modularity.ModularErrataCopyTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test recursive and recursive_conservative flags during copy.

This test targets the following issues:

Recursive copy of RHEA-2012:0059 should copy:

  • 2 modules: duck and kangaroo.
  • 2 modulemd_defaults duck and kangaroo.
  • 2 RPMS: kangaroo-0.3-1.noarch.rpm, and duck-0.7-1.noarch.rpm.

Copy of module_defaults introduced in Pulp 2.21.

Exercise the use of recursive and recursive_conservative.

copy_modular_errata(recursive, recursive_conservative, old_dependency=False)

Copy modular errata.

make_assertions_dependency(repo)

Make assertions over a repo with an older version of RPM present.

make_assertions_nodependency(repo)

Make assertions over a repo without an older version RPM present.

classmethod setUpClass()

Create class-wide variables.

test_norecursive_conservative_dependency()

Non-recursive, conservative, and older version of RPM present.

test_norecursive_conservative_nodepdendency()

Non-Recursive, conservative, and no old dependency.

test_recursive_conservative_nodepdendency()

Recursive, conservative, and no old dependency.

test_recursive_noconservative_dependency()

Recursive, non-conservative, and older version of RPM present.

test_recursive_noconservative_nodependency()

Recursive, non-conservative, and no old dependency.

class pulp_2_tests.tests.rpm.api_v2.test_modularity.PackageManagerModuleListTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Package manager can read module list from a Pulp repository.

test_all()

Package manager can read module list from a Pulp repository.

pulp_2_tests.tests.rpm.api_v2.test_modularity.RPM_WITH_ERRATUM_METADATA = mappingproxy({'name': 'bear', 'epoch': '0', 'version': '4.1', 'release': 1, 'arch': 'noarch', 'vendor': None})

Metadata for an RPM with an associated erratum.

class pulp_2_tests.tests.rpm.api_v2.test_modularity.UploadModuleTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Upload a module.yaml file and test upload import in Pulp repository.

classmethod setUpClass()

Create class wide variables.

test_one_default_per_repo()

Verify changing the modules default content of modules.yaml.

Do not modifies the repo.

test_upload_module()

Verify whether uploaded module.yaml is updated in the pulp repo.