diff --git a/tests/foreman/cli/test_errata.py b/tests/foreman/cli/test_errata.py index 245fd3b01b0..b4947fa4de8 100644 --- a/tests/foreman/cli/test_errata.py +++ b/tests/foreman/cli/test_errata.py @@ -18,6 +18,7 @@ """ from datetime import date, datetime, timedelta from operator import itemgetter +from time import sleep from broker import Broker from nailgun import entities @@ -194,9 +195,10 @@ def hosts(request): @pytest.fixture(scope='module') def register_hosts( hosts, - module_org, + module_entitlement_manifest_org, module_lce, module_ak, + module_cv, rh_repo, custom_repo, module_target_sat, @@ -209,7 +211,7 @@ def register_hosts( module_target_sat.cli_factory.setup_org_for_a_custom_repo( { 'url': REPO_WITH_ERRATA['url'], - 'organization-id': module_org.id, + 'organization-id': module_entitlement_manifest_org.id, 'lifecycle-environment-id': module_lce.id, 'activationkey-id': module_ak.id, } @@ -217,7 +219,7 @@ def register_hosts( host.register( activation_keys=module_ak.name, target=module_target_sat, - org=module_org, + org=module_entitlement_manifest_org, loc=None, ) assert host.subscribed @@ -230,6 +232,8 @@ def errata_hosts(register_hosts, module_target_sat, module_org, module_lce, modu """Ensure that rpm is installed on host.""" for host in register_hosts: # Remove all packages. + host.execute(r'subscription-manager repos --enable \*') + host.execute(r'yum-config-manager --enable \*') for errata in REPO_WITH_ERRATA['errata']: # Remove package if present, old or new. package_name = errata['package_name'] @@ -300,8 +304,9 @@ def get_sorted_errata_info_by_id(errata_ids, sort_by='issued', sort_reversed=Fal return sorted(errata_info, key=itemgetter(sort_by), reverse=sort_reversed) -def get_errata_ids(*params): +def get_errata_ids(self, *params): """Return list of sets of errata ids corresponding to the provided params.""" + # self.run('subscription-manager repos') errata_ids = [{errata['errata-id'] for errata in Erratum.list(param)} for param in params] return errata_ids[0] if len(errata_ids) == 1 else errata_ids @@ -719,8 +724,11 @@ def test_positive_list_affected_chosts_by_erratum_restrict_flag( """ # Uninstall package so that only the first errata applies. for host in errata_hosts: + host.execute(r'subscription-manager repos --enable \*') + host.execute(r'yum-config-manager --enable \*') host.execute(f'yum erase -y {REPO_WITH_ERRATA["errata"][1]["package_name"]}') host.execute('subscription-manager repos') + sleep(20) # Create list of uninstallable errata. errata = REPO_WITH_ERRATA['errata'][0] uninstallable = REPO_WITH_ERRATA['errata_ids'].copy() @@ -728,7 +736,6 @@ def test_positive_list_affected_chosts_by_erratum_restrict_flag( # Check search for only installable errata param = { 'errata-restrict-installable': 1, - 'content-view-id': module_cv.id, 'lifecycle-environment-id': module_lce.id, 'organization-id': module_entitlement_manifest_org.id, 'per-page': PER_PAGE_LARGE,