From b38610eda1aaf77d0230f471f7855191c235ebeb Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 19 Mar 2024 12:49:39 -0500 Subject: [PATCH 1/7] CC Automation/Comp Eval coverage --- tests/foreman/api/test_contentview.py | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index d898c2604b3..02f4ddb6f05 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -22,6 +22,7 @@ from robottelo.constants import ( CONTAINER_REGISTRY_HUB, CUSTOM_RPM_SHA_512_FEED_COUNT, + DEFAULT_ARCHITECTURE, FILTER_ERRATA_TYPE, PERMISSIONS, PRDS, @@ -279,6 +280,67 @@ 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_entitlement_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 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_entitlement_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_entitlement_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_entitlement_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_entitlement_manifest_org, + registry_name_pattern='<%= repository.name %>', + ).create() + lce2 = module_target_sat.api.LifecycleEnvironment( + organization=module_entitlement_manifest_org, + registry_name_pattern='<%= lifecycle_environment.label %>/<%= repository.name %>', + ).create() + version = composite_cv.version[0].read() + assert version.promote(data={'environment_ids': lce1.id}) + assert version.promote(data={'environment_ids': lce2.id}) + class TestContentViewCreate: """Create tests for content views.""" From 30d98c7b3f2f67f1f00007ede01cd81107397132 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Mon, 8 Apr 2024 10:52:08 -0500 Subject: [PATCH 2/7] change to non-sca org --- tests/foreman/api/test_contentview.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index 02f4ddb6f05..9ab6bfbfb8d 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -282,7 +282,7 @@ def test_positive_add_sha512_rpm(self, content_view, module_org, module_target_s @pytest.mark.tier2 def test_ccv_promote_registry_name_change( - self, module_target_sat, module_entitlement_manifest_org + self, module_target_sat, module_sca_manifest_org ): """Testing CCV promotion scenarios where the registry_name has been changed to some specific value. @@ -307,7 +307,7 @@ def test_ccv_promote_registry_name_change( """ rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( basearch=DEFAULT_ARCHITECTURE, - org_id=module_entitlement_manifest_org.id, + 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'], @@ -316,13 +316,13 @@ def test_ccv_promote_registry_name_change( repo = module_target_sat.api.Repository(id=rh_repo_id).read() repo.sync(timeout=600) cv = module_target_sat.api.ContentView( - organization=module_entitlement_manifest_org + 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_entitlement_manifest_org, composite=True + organization=module_sca_manifest_org, composite=True ).create() composite_cv.component = [cv.version[0]] composite_cv = composite_cv.update(['component']) @@ -330,11 +330,11 @@ def test_ccv_promote_registry_name_change( composite_cv = composite_cv.read() # Create LCEs with the specific registry value lce1 = module_target_sat.api.LifecycleEnvironment( - organization=module_entitlement_manifest_org, + organization=module_sca_manifest_org, registry_name_pattern='<%= repository.name %>', ).create() lce2 = module_target_sat.api.LifecycleEnvironment( - organization=module_entitlement_manifest_org, + organization=module_sca_manifest_org, registry_name_pattern='<%= lifecycle_environment.label %>/<%= repository.name %>', ).create() version = composite_cv.version[0].read() From db5d817de5090a0f32a1fab1885a22b6d713db90 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 19 Mar 2024 12:49:39 -0500 Subject: [PATCH 3/7] CC Automation/Comp Eval coverage --- tests/foreman/api/test_contentview.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index 9ab6bfbfb8d..38cc3f38ed3 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -282,7 +282,11 @@ def test_positive_add_sha512_rpm(self, content_view, module_org, module_target_s @pytest.mark.tier2 def test_ccv_promote_registry_name_change( +<<<<<<< HEAD self, module_target_sat, module_sca_manifest_org +======= + self, module_target_sat, module_entitlement_manifest_org +>>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) ): """Testing CCV promotion scenarios where the registry_name has been changed to some specific value. @@ -307,7 +311,11 @@ def test_ccv_promote_registry_name_change( """ rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( basearch=DEFAULT_ARCHITECTURE, +<<<<<<< HEAD org_id=module_sca_manifest_org.id, +======= + org_id=module_entitlement_manifest_org.id, +>>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) product=REPOS['kickstart']['rhel8_aps']['product'], repo=REPOS['kickstart']['rhel8_aps']['name'], reposet=REPOS['kickstart']['rhel8_aps']['reposet'], @@ -316,13 +324,21 @@ def test_ccv_promote_registry_name_change( repo = module_target_sat.api.Repository(id=rh_repo_id).read() repo.sync(timeout=600) cv = module_target_sat.api.ContentView( +<<<<<<< HEAD organization=module_sca_manifest_org +======= + organization=module_entitlement_manifest_org +>>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) ).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( +<<<<<<< HEAD organization=module_sca_manifest_org, composite=True +======= + organization=module_entitlement_manifest_org, composite=True +>>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) ).create() composite_cv.component = [cv.version[0]] composite_cv = composite_cv.update(['component']) @@ -330,11 +346,19 @@ def test_ccv_promote_registry_name_change( composite_cv = composite_cv.read() # Create LCEs with the specific registry value lce1 = module_target_sat.api.LifecycleEnvironment( +<<<<<<< HEAD organization=module_sca_manifest_org, registry_name_pattern='<%= repository.name %>', ).create() lce2 = module_target_sat.api.LifecycleEnvironment( organization=module_sca_manifest_org, +======= + organization=module_entitlement_manifest_org, + registry_name_pattern='<%= repository.name %>', + ).create() + lce2 = module_target_sat.api.LifecycleEnvironment( + organization=module_entitlement_manifest_org, +>>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) registry_name_pattern='<%= lifecycle_environment.label %>/<%= repository.name %>', ).create() version = composite_cv.version[0].read() From d673bf4ad850e4cd89146d490e37ff83a369dc45 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Mon, 8 Apr 2024 10:52:08 -0500 Subject: [PATCH 4/7] change to non-sca org --- tests/foreman/api/test_contentview.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index 38cc3f38ed3..581ad6a3eb7 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -282,11 +282,15 @@ def test_positive_add_sha512_rpm(self, content_view, module_org, module_target_s @pytest.mark.tier2 def test_ccv_promote_registry_name_change( +<<<<<<< HEAD <<<<<<< HEAD self, module_target_sat, module_sca_manifest_org ======= self, module_target_sat, module_entitlement_manifest_org >>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) +======= + self, module_target_sat, module_sca_manifest_org +>>>>>>> 2d1d7cb31 (change to non-sca org) ): """Testing CCV promotion scenarios where the registry_name has been changed to some specific value. @@ -311,11 +315,15 @@ def test_ccv_promote_registry_name_change( """ rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( basearch=DEFAULT_ARCHITECTURE, +<<<<<<< HEAD <<<<<<< HEAD org_id=module_sca_manifest_org.id, ======= org_id=module_entitlement_manifest_org.id, >>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) +======= + org_id=module_sca_manifest_org.id, +>>>>>>> 2d1d7cb31 (change to non-sca org) product=REPOS['kickstart']['rhel8_aps']['product'], repo=REPOS['kickstart']['rhel8_aps']['name'], reposet=REPOS['kickstart']['rhel8_aps']['reposet'], @@ -324,21 +332,29 @@ def test_ccv_promote_registry_name_change( repo = module_target_sat.api.Repository(id=rh_repo_id).read() repo.sync(timeout=600) cv = module_target_sat.api.ContentView( +<<<<<<< HEAD <<<<<<< HEAD organization=module_sca_manifest_org ======= organization=module_entitlement_manifest_org >>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) +======= + organization=module_sca_manifest_org +>>>>>>> 2d1d7cb31 (change to non-sca 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( +<<<<<<< HEAD <<<<<<< HEAD organization=module_sca_manifest_org, composite=True ======= organization=module_entitlement_manifest_org, composite=True >>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) +======= + organization=module_sca_manifest_org, composite=True +>>>>>>> 2d1d7cb31 (change to non-sca org) ).create() composite_cv.component = [cv.version[0]] composite_cv = composite_cv.update(['component']) @@ -346,6 +362,7 @@ def test_ccv_promote_registry_name_change( composite_cv = composite_cv.read() # Create LCEs with the specific registry value lce1 = module_target_sat.api.LifecycleEnvironment( +<<<<<<< HEAD <<<<<<< HEAD organization=module_sca_manifest_org, registry_name_pattern='<%= repository.name %>', @@ -359,6 +376,13 @@ def test_ccv_promote_registry_name_change( lce2 = module_target_sat.api.LifecycleEnvironment( organization=module_entitlement_manifest_org, >>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) +======= + organization=module_sca_manifest_org, + registry_name_pattern='<%= repository.name %>', + ).create() + lce2 = module_target_sat.api.LifecycleEnvironment( + organization=module_sca_manifest_org, +>>>>>>> 2d1d7cb31 (change to non-sca org) registry_name_pattern='<%= lifecycle_environment.label %>/<%= repository.name %>', ).create() version = composite_cv.version[0].read() From 9581ae003c6834980a3f2a069c20ddad5df1dd69 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Mon, 8 Apr 2024 11:01:20 -0500 Subject: [PATCH 5/7] Fix formatting issues --- tests/foreman/api/test_contentview.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index 581ad6a3eb7..ac096b669f3 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -281,6 +281,7 @@ def test_positive_add_sha512_rpm(self, content_view, module_org, module_target_s ) @pytest.mark.tier2 +<<<<<<< HEAD def test_ccv_promote_registry_name_change( <<<<<<< HEAD <<<<<<< HEAD @@ -292,6 +293,9 @@ def test_ccv_promote_registry_name_change( self, module_target_sat, module_sca_manifest_org >>>>>>> 2d1d7cb31 (change to non-sca org) ): +======= + def test_ccv_promote_registry_name_change(self, module_target_sat, module_sca_manifest_org): +>>>>>>> d877d0cd5 (Fix formatting issues) """Testing CCV promotion scenarios where the registry_name has been changed to some specific value. @@ -331,6 +335,7 @@ def test_ccv_promote_registry_name_change( ) repo = module_target_sat.api.Repository(id=rh_repo_id).read() repo.sync(timeout=600) +<<<<<<< HEAD cv = module_target_sat.api.ContentView( <<<<<<< HEAD <<<<<<< HEAD @@ -342,6 +347,9 @@ def test_ccv_promote_registry_name_change( organization=module_sca_manifest_org >>>>>>> 2d1d7cb31 (change to non-sca org) ).create() +======= + cv = module_target_sat.api.ContentView(organization=module_sca_manifest_org).create() +>>>>>>> d877d0cd5 (Fix formatting issues) cv = module_target_sat.api.ContentView(id=cv.id, repository=[repo]).update(["repository"]) cv.publish() cv = cv.read() From dfb2673d3403c46610d1a6022610b1462bc3b6c9 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 30 Apr 2024 12:24:16 -0500 Subject: [PATCH 6/7] Adjust assert statement, and fix docstring issue --- tests/foreman/api/test_contentview.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index ac096b669f3..83afeab9d7f 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -305,7 +305,7 @@ def test_ccv_promote_registry_name_change(self, module_target_sat, module_sca_ma 1) Sync a RH Repo 2) Create a CV, add the repo and publish it - 3) Create a CCV and add the CV to it, then 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 @@ -394,8 +394,8 @@ def test_ccv_promote_registry_name_change(self, module_target_sat, module_sca_ma registry_name_pattern='<%= lifecycle_environment.label %>/<%= repository.name %>', ).create() version = composite_cv.version[0].read() - assert version.promote(data={'environment_ids': lce1.id}) - assert version.promote(data={'environment_ids': lce2.id}) + assert 'success' in version.promote(data={'environment_ids': lce1.id})['result'] + assert 'success' in version.promote(data={'environment_ids': lce2.id})['result'] class TestContentViewCreate: From b7ec7e1205d2f95e2a746aef2ef4a5158e80deef Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 30 Apr 2024 12:24:54 -0500 Subject: [PATCH 7/7] Adjust assert statement, and fix docstring issue --- tests/foreman/api/test_contentview.py | 62 +-------------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index 83afeab9d7f..eda0c9ec6b2 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -281,21 +281,7 @@ def test_positive_add_sha512_rpm(self, content_view, module_org, module_target_s ) @pytest.mark.tier2 -<<<<<<< HEAD - def test_ccv_promote_registry_name_change( -<<<<<<< HEAD -<<<<<<< HEAD - self, module_target_sat, module_sca_manifest_org -======= - self, module_target_sat, module_entitlement_manifest_org ->>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) -======= - self, module_target_sat, module_sca_manifest_org ->>>>>>> 2d1d7cb31 (change to non-sca org) - ): -======= def test_ccv_promote_registry_name_change(self, module_target_sat, module_sca_manifest_org): ->>>>>>> d877d0cd5 (Fix formatting issues) """Testing CCV promotion scenarios where the registry_name has been changed to some specific value. @@ -319,15 +305,7 @@ def test_ccv_promote_registry_name_change(self, module_target_sat, module_sca_ma """ rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( basearch=DEFAULT_ARCHITECTURE, -<<<<<<< HEAD -<<<<<<< HEAD - org_id=module_sca_manifest_org.id, -======= - org_id=module_entitlement_manifest_org.id, ->>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) -======= org_id=module_sca_manifest_org.id, ->>>>>>> 2d1d7cb31 (change to non-sca org) product=REPOS['kickstart']['rhel8_aps']['product'], repo=REPOS['kickstart']['rhel8_aps']['name'], reposet=REPOS['kickstart']['rhel8_aps']['reposet'], @@ -335,34 +313,12 @@ def test_ccv_promote_registry_name_change(self, module_target_sat, module_sca_ma ) repo = module_target_sat.api.Repository(id=rh_repo_id).read() repo.sync(timeout=600) -<<<<<<< HEAD - cv = module_target_sat.api.ContentView( -<<<<<<< HEAD -<<<<<<< HEAD - organization=module_sca_manifest_org -======= - organization=module_entitlement_manifest_org ->>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) -======= - organization=module_sca_manifest_org ->>>>>>> 2d1d7cb31 (change to non-sca org) - ).create() -======= cv = module_target_sat.api.ContentView(organization=module_sca_manifest_org).create() ->>>>>>> d877d0cd5 (Fix formatting issues) 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( -<<<<<<< HEAD -<<<<<<< HEAD organization=module_sca_manifest_org, composite=True -======= - organization=module_entitlement_manifest_org, composite=True ->>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) -======= - organization=module_sca_manifest_org, composite=True ->>>>>>> 2d1d7cb31 (change to non-sca org) ).create() composite_cv.component = [cv.version[0]] composite_cv = composite_cv.update(['component']) @@ -370,31 +326,15 @@ def test_ccv_promote_registry_name_change(self, module_target_sat, module_sca_ma composite_cv = composite_cv.read() # Create LCEs with the specific registry value lce1 = module_target_sat.api.LifecycleEnvironment( -<<<<<<< HEAD -<<<<<<< HEAD - organization=module_sca_manifest_org, - registry_name_pattern='<%= repository.name %>', - ).create() - lce2 = module_target_sat.api.LifecycleEnvironment( - organization=module_sca_manifest_org, -======= - organization=module_entitlement_manifest_org, - registry_name_pattern='<%= repository.name %>', - ).create() - lce2 = module_target_sat.api.LifecycleEnvironment( - organization=module_entitlement_manifest_org, ->>>>>>> 9c8e7f7a9 (CC Automation/Comp Eval coverage) -======= organization=module_sca_manifest_org, registry_name_pattern='<%= repository.name %>', ).create() lce2 = module_target_sat.api.LifecycleEnvironment( organization=module_sca_manifest_org, ->>>>>>> 2d1d7cb31 (change to non-sca 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': lce1.id})['result'] assert 'success' in version.promote(data={'environment_ids': lce2.id})['result']