From 794a709104fe3f0eac5c6cfd58c502363efe291d Mon Sep 17 00:00:00 2001 From: Cole Higgins Date: Fri, 1 Sep 2023 13:42:21 -0400 Subject: [PATCH 1/3] test for syncing multiple large repos --- tests/foreman/api/test_repositories.py | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/foreman/api/test_repositories.py b/tests/foreman/api/test_repositories.py index 49b0ff61fea..ed85c791fff 100644 --- a/tests/foreman/api/test_repositories.py +++ b/tests/foreman/api/test_repositories.py @@ -24,7 +24,9 @@ from robottelo import constants from robottelo.cli.base import CLIReturnCodeError from robottelo.config import settings +from robottelo.constants import DEFAULT_ARCHITECTURE from robottelo.constants import MIRRORING_POLICIES +from robottelo.constants import REPOS from robottelo.utils.datafactory import parametrized @@ -242,3 +244,53 @@ def test_positive_multiple_orgs_with_same_repo(target_sat): repo_counts = target_sat.api.Repository(id=repo.id).read().content_counts repos.append(repo_counts) assert repos[0] == repos[1] == repos[2] + + +def test_positive_sync_mulitple_large_repos(module_target_sat, module_entitlement_manifest_org): + """Enable and bulk sync multiple large repositories + + :id: b51c4a3d-d532-4342-be61-e868f7c3a723 + + :Steps: + 1. Enabled multiple large Repositories + Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs 8 + Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8 + Red Hat Enterprise Linux 8 for x86_64 - AppStream Kickstart 8.7 + Red Hat Enterprise Linux 8 for x86_64 - BaseOS Kickstart 8.7 + 2. Sync all four repositories at the same time + 3. Assert that the bulk sync succeeds + + :customerscenario: true + + :expectedresults: All repositories should sync with no errors + + :BZ: 2224031 + """ + repo_names = ['rhel8_bos', 'rhel8_aps'] + kickstart_names = ['rhel8_bos', 'rhel8_aps'] + for name in repo_names: + rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( + basearch=DEFAULT_ARCHITECTURE, + org_id=module_entitlement_manifest_org.id, + product=REPOS[name]['product'], + repo=REPOS[name]['name'], + reposet=REPOS[name]['reposet'], + releasever=REPOS[name]['releasever'], + ) + + for name in kickstart_names: + rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( + basearch=constants.DEFAULT_ARCHITECTURE, + org_id=module_entitlement_manifest_org.id, + product=constants.REPOS['kickstart'][name]['product'], + repo=constants.REPOS['kickstart'][name]['name'], + reposet=constants.REPOS['kickstart'][name]['reposet'], + releasever=constants.REPOS['kickstart'][name]['version'], + ) + rh_repos = entities.Repository(id=rh_repo_id).read() + rh_products = entities.Product(id=rh_repos.product.id).read() + assert len(rh_products.repository) == 4 + res = module_target_sat.api.ProductBulkAction().sync( + data={'ids': [rh_products.id]}, timeout=2000 + ) + assert res['result'] == 'success' From d3e78f2a9858106d11f8a84b9ba96e9c41a9d577 Mon Sep 17 00:00:00 2001 From: Cole Higgins Date: Tue, 5 Sep 2023 13:48:48 -0400 Subject: [PATCH 2/3] Adressing comments --- tests/foreman/api/test_repositories.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/foreman/api/test_repositories.py b/tests/foreman/api/test_repositories.py index ed85c791fff..4a2a209101d 100644 --- a/tests/foreman/api/test_repositories.py +++ b/tests/foreman/api/test_repositories.py @@ -255,13 +255,11 @@ def test_positive_sync_mulitple_large_repos(module_target_sat, module_entitlemen 1. Enabled multiple large Repositories Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs 8 Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8 - Red Hat Enterprise Linux 8 for x86_64 - AppStream Kickstart 8.7 - Red Hat Enterprise Linux 8 for x86_64 - BaseOS Kickstart 8.7 + Red Hat Enterprise Linux 8 for x86_64 - AppStream Kickstart 8 + Red Hat Enterprise Linux 8 for x86_64 - BaseOS Kickstart 8 2. Sync all four repositories at the same time 3. Assert that the bulk sync succeeds - :customerscenario: true - :expectedresults: All repositories should sync with no errors :BZ: 2224031 @@ -287,8 +285,8 @@ def test_positive_sync_mulitple_large_repos(module_target_sat, module_entitlemen reposet=constants.REPOS['kickstart'][name]['reposet'], releasever=constants.REPOS['kickstart'][name]['version'], ) - rh_repos = entities.Repository(id=rh_repo_id).read() - rh_products = entities.Product(id=rh_repos.product.id).read() + rh_repos = module_target_sat.api.Repository(id=rh_repo_id).read() + rh_products = module_target_sat.api.Product(id=rh_repos.product.id).read() assert len(rh_products.repository) == 4 res = module_target_sat.api.ProductBulkAction().sync( data={'ids': [rh_products.id]}, timeout=2000 From 0650e39e575d068a718e8ee28098375841ce3d2b Mon Sep 17 00:00:00 2001 From: Cole Higgins Date: Mon, 27 Nov 2023 16:06:59 -0500 Subject: [PATCH 3/3] precommit fix --- tests/foreman/api/test_repositories.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/foreman/api/test_repositories.py b/tests/foreman/api/test_repositories.py index 4a2a209101d..18051c0c344 100644 --- a/tests/foreman/api/test_repositories.py +++ b/tests/foreman/api/test_repositories.py @@ -24,9 +24,7 @@ from robottelo import constants from robottelo.cli.base import CLIReturnCodeError from robottelo.config import settings -from robottelo.constants import DEFAULT_ARCHITECTURE -from robottelo.constants import MIRRORING_POLICIES -from robottelo.constants import REPOS +from robottelo.constants import DEFAULT_ARCHITECTURE, MIRRORING_POLICIES, REPOS from robottelo.utils.datafactory import parametrized @@ -267,7 +265,7 @@ def test_positive_sync_mulitple_large_repos(module_target_sat, module_entitlemen repo_names = ['rhel8_bos', 'rhel8_aps'] kickstart_names = ['rhel8_bos', 'rhel8_aps'] for name in repo_names: - rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid( + module_target_sat.api_factory.enable_rhrepo_and_fetchid( basearch=DEFAULT_ARCHITECTURE, org_id=module_entitlement_manifest_org.id, product=REPOS[name]['product'], @@ -286,9 +284,9 @@ def test_positive_sync_mulitple_large_repos(module_target_sat, module_entitlemen releasever=constants.REPOS['kickstart'][name]['version'], ) rh_repos = module_target_sat.api.Repository(id=rh_repo_id).read() - rh_products = module_target_sat.api.Product(id=rh_repos.product.id).read() - assert len(rh_products.repository) == 4 + rh_product = module_target_sat.api.Product(id=rh_repos.product.id).read() + assert len(rh_product.repository) == 4 res = module_target_sat.api.ProductBulkAction().sync( - data={'ids': [rh_products.id]}, timeout=2000 + data={'ids': [rh_product.id]}, timeout=2000 ) assert res['result'] == 'success'