diff --git a/tests/foreman/cli/test_remoteexecution.py b/tests/foreman/cli/test_remoteexecution.py index 5520451f109..2bf4b6a3ba4 100644 --- a/tests/foreman/cli/test_remoteexecution.py +++ b/tests/foreman/cli/test_remoteexecution.py @@ -24,7 +24,7 @@ from robottelo import constants from robottelo.config import settings -from robottelo.constants import PRDS, REPOS, REPOSET +from robottelo.constants import FAKE_4_CUSTOM_PACKAGE, PRDS, REPOS, REPOSET from robottelo.hosts import ContentHost from robottelo.utils import ohsnap from robottelo.utils.datafactory import filtered_datapoint, parametrized @@ -1524,3 +1524,85 @@ def test_positive_run_pull_job_on_offline_host( assert_job_invocation_result( module_target_sat, invocation_command['id'], rhel_contenthost.hostname ) + + @pytest.mark.tier3 + @pytest.mark.e2e + @pytest.mark.no_containers + @pytest.mark.rhel_ver_match('8') + @pytest.mark.parametrize( + 'setting_update', + ['remote_execution_global_proxy=False'], + ids=["no_global_proxy"], + indirect=True, + ) + def test_positive_apply_errata_on_pull_provider_host( + self, + module_org, + module_target_sat, + smart_proxy_location, + module_ak_with_cv, + module_capsule_configured_mqtt, + rhel_contenthost, + setting_update, + ): + """Apply errata on host registered to mqtt + + :id: 8c644404-4a26-4e18-ac59-138fd53ffc44 + + :expectedresults: Verify that errata were successfully applied on host registered to mqtt + + :CaseImportance: Critical + + :BZ: 2115767 + + :customerscenario: true + + :parametrized: yes + """ + client_repo = ohsnap.dogfood_repository( + settings.ohsnap, + product='client', + repo='client', + release='client', + os_release=rhel_contenthost.os_version.major, + ) + # Update module_capsule_configured_mqtt to include module_org/smart_proxy_location + module_target_sat.cli.Capsule.update( + { + 'name': module_capsule_configured_mqtt.hostname, + 'organization-ids': module_org.id, + 'location-ids': smart_proxy_location.id, + } + ) + # register host with pull provider rex (SAT-1677) + result = rhel_contenthost.register( + module_org, + smart_proxy_location, + module_ak_with_cv.name, + module_capsule_configured_mqtt, + setup_remote_execution_pull=True, + repo=client_repo.baseurl, + ignore_subman_errors=True, + force=True, + ) + + assert result.status == 0, f'Failed to register host: {result.stderr}' + # check mqtt client is running + result = rhel_contenthost.execute('systemctl status yggdrasild') + assert result.status == 0, f'Failed to start yggdrasil on client: {result.stderr}' + + # enable repo, install old pkg + rhel_contenthost.execute(f'yum-config-manager --add-repo {settings.repos.yum_6.url}') + rhel_contenthost.execute(f'yum install {FAKE_4_CUSTOM_PACKAGE} -y') + # run script provider rex command to apply errata + invocation_command = module_target_sat.cli_factory.job_invocation( + { + 'feature': 'katello_errata_install', + 'search-query': f"name ~ {rhel_contenthost.hostname}", + 'inputs': f'errata={settings.repos.yum_6.errata[0]}', + 'organization-id': f'{module_org.id}', + } + ) + assert_job_invocation_result( + module_target_sat, invocation_command['id'], rhel_contenthost.hostname + )