From 00f77f1d0a18482169a886770c550c6c27e8f18b Mon Sep 17 00:00:00 2001 From: Samuel Bible Date: Tue, 30 Apr 2024 14:58:22 -0500 Subject: [PATCH] CC Automation/Comp Eval coverage - promote CCV with specific registry_name (#14451) * CC Automation/Comp Eval coverage * change to non-sca org * CC Automation/Comp Eval coverage * change to non-sca org * Fix formatting issues * Adjust assert statement, and fix docstring issue * Adjust assert statement, and fix docstring issue (cherry picked from commit 3f1b9e419c906275b739a03019c094960afed68f) --- tests/foreman/api/test_contentview.py | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index 03c95999417..92de5aaacdf 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -21,6 +21,7 @@ from robottelo.constants import ( CONTAINER_REGISTRY_HUB, CUSTOM_RPM_SHA_512_FEED_COUNT, + DEFAULT_ARCHITECTURE, FILTER_ERRATA_TYPE, PERMISSIONS, PRDS, @@ -278,6 +279,63 @@ def test_positive_add_sha512_rpm(self, content_view, module_org, module_target_s content_view_version.errata_counts['total'] == CUSTOM_RPM_SHA_512_FEED_COUNT['errata'] ) + @pytest.mark.tier2 + def test_ccv_promote_registry_name_change(self, module_target_sat, module_sca_manifest_org): + """Testing CCV promotion scenarios where the registry_name has been changed to some + specific value. + + :id: 41641d4a-d144-4833-869a-284624df2410 + + :steps: + + 1) Sync a RH Repo + 2) Create a CV, add the repo and publish it + 3) Create a CCV and add the CV version to it, then publish it + 4) Create LCEs with the specific value for registry_name + 5) Promote the CCV to both LCEs + + :expectedresults: CCV can be promoted to both LCEs without issue. + + :CaseImportance: High + + :customerscenario: true + + :BZ: 2153523 + """ + rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( + basearch=DEFAULT_ARCHITECTURE, + org_id=module_sca_manifest_org.id, + product=REPOS['kickstart']['rhel8_aps']['product'], + repo=REPOS['kickstart']['rhel8_aps']['name'], + reposet=REPOS['kickstart']['rhel8_aps']['reposet'], + releasever=REPOS['kickstart']['rhel8_aps']['version'], + ) + repo = module_target_sat.api.Repository(id=rh_repo_id).read() + repo.sync(timeout=600) + cv = module_target_sat.api.ContentView(organization=module_sca_manifest_org).create() + cv = module_target_sat.api.ContentView(id=cv.id, repository=[repo]).update(["repository"]) + cv.publish() + cv = cv.read() + composite_cv = module_target_sat.api.ContentView( + organization=module_sca_manifest_org, composite=True + ).create() + composite_cv.component = [cv.version[0]] + composite_cv = composite_cv.update(['component']) + composite_cv.publish() + composite_cv = composite_cv.read() + # Create LCEs with the specific registry value + lce1 = module_target_sat.api.LifecycleEnvironment( + organization=module_sca_manifest_org, + registry_name_pattern='<%= repository.name %>', + ).create() + lce2 = module_target_sat.api.LifecycleEnvironment( + organization=module_sca_manifest_org, + registry_name_pattern='<%= lifecycle_environment.label %>/<%= repository.name %>', + ).create() + version = composite_cv.version[0].read() + assert 'success' in version.promote(data={'environment_ids': lce1.id})['result'] + assert 'success' in version.promote(data={'environment_ids': lce2.id})['result'] + class TestContentViewCreate: """Create tests for content views."""