diff --git a/tests/foreman/api/test_errata.py b/tests/foreman/api/test_errata.py index 5c00f7114c2..2658fe5771a 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -202,15 +202,19 @@ def test_positive_install_multiple_in_host( rhel_contenthost.register_contenthost(function_org.name, activation_key.name, function_lce.name) rhel_contenthost.run(r'subscription-manager repos --enable \*') assert rhel_contenthost.subscribed + # Installing outdated custom packages: for package in constants.FAKE_9_YUM_OUTDATED_PACKAGES: assert rhel_contenthost.run(f'yum install -y {package}').status == 0 - applicable_errata_count = rhel_contenthost.applicable_errata_count - assert applicable_errata_count > 1 + assert rhel_contenthost.run(f'rpm -q {package}').status == 0 rhel_contenthost.add_rex_key(satellite=module_target_sat) + original_applicable_count = rhel_contenthost.applicable_errata_count - # Each applicable errata will be installed sequentially, + # Each errata will be installed sequentially, # after each install, applicable-errata-count should drop by one. - for errata in settings.repos.yum_9.errata[1:4]: + installed_errata_count = 0 + for errata in constants.FAKE_9_YUM_SECURITY_ERRATUM: + applicable_errata_count = rhel_contenthost.applicable_errata_count + assert applicable_errata_count > 1 task_id = module_target_sat.api.JobInvocation().run( data={ 'feature': 'katello_errata_install', @@ -227,6 +231,12 @@ def test_positive_install_multiple_in_host( ) applicable_errata_count -= 1 assert rhel_contenthost.applicable_errata_count == applicable_errata_count + installed_errata_count += 1 + + assert ( + rhel_contenthost.applicable_errata_count + == original_applicable_count - installed_errata_count + ) @pytest.mark.tier3