Skip to content

Commit

Permalink
check debug log for expected host
Browse files Browse the repository at this point in the history
  • Loading branch information
amolpati30 committed Aug 20, 2024
1 parent 006ea1c commit bb58fc1
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions tests/foreman/ui/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,10 @@ def test_positive_ansible_config_report_changes_notice_and_failed_tasks_errors(
notice_log = session.configreport.search(rhel_contenthost.hostname)
assert f'notice Install the {package_name} package' in notice_log['permission_denied']
assert f'Installed: rubygem-{package_name}' in notice_log['permission_denied']

@pytest.mark.tier3
def test_positive_debug_log_for_host(
self, module_target_sat, module_org, module_location, module_activation_key
):

@pytest.mark.no_containers
@pytest.mark.rhel_ver_list([settings.content_host.default_rhel_version])
def test_positive_debug_log_for_host(self, target_sat, module_org, module_location, module_ak_with_cv):
"""Verify debug mode output for host
:id: 06e0a95c-530b-11ef-a28c-36dcd2c0c415
Expand All @@ -627,28 +626,37 @@ def test_positive_debug_log_for_host(
:customerscenario: true
"""
SELECTED_ROLE = 'RedHatInsights.insights-client'
id = module_target_sat.nailgun_smart_proxy.id
module_target_sat.api.AnsibleRoles().sync(
data={'proxy_id': id, 'role_names': SELECTED_ROLE}
nc = target_sat.nailgun_smart_proxy
nc.location = [module_location]
nc.organization = [module_org]
nc.update(['organization', 'location'])
target_sat.api.AnsibleRoles().sync(
data={'proxy_id': nc.id, 'role_names': SELECTED_ROLE}
)
with Broker(nick='rhel7', host_class=ContentHost, _count=2) as clients:
rhel_ver = settings.content_host.default_rhel_version
with Broker(nick=f'rhel{rhel_ver}', host_class=ContentHost, _count=2) as clients:
vm1, vm2 = clients
vm1.create_custom_repos(rhel8=settings.repos.rhel8_os)
result1 = vm1.register(
module_org, module_location, module_activation_key.name, module_target_sat
module_org, module_location, module_ak_with_cv.name, target_sat
)
assert result1.status == 0, f'Failed to register host: {result1.stderr}'
vm2.create_custom_repos(rhel8=settings.repos.rhel8_os)
result2 = vm2.register(
module_org, module_location, module_activation_key.name, module_target_sat
module_org, module_location, module_ak_with_cv.name, target_sat
)
assert result2.status == 0, f'Failed to register host: {result2.stderr}'
with module_target_sat.ui_session() as session:
session.organization.select(module_org.name)
session.location.select(module_location.name)
session.host.select_checkbox()
session.host.apply_action(
'Run all Ansible roles', entities_list=None)
result = session.jobinvocation.search('overview')
wait_for(lambda: result['job_status'] == 'passed')
with target_sat.ui_session() as session:
session.organization.select(module_org.name)
session.location.select(module_location.name)
session.host.select_checkbox()
session.host._select_action('Run all Ansible roles', [vm1.hostname, vm2.hostname])
session.jobinvocation.wait_job_invocation_state(
entity_name='Run ansible roles', host_name=vm1.hostname
)
output = session.jobinvocation.dynflow_output('Run ansible roles', vm1.hostname)
assert vm1.hostname in output
assert vm2.hostname not in output


class TestAnsibleREX:
Expand Down Expand Up @@ -916,3 +924,4 @@ def test_positive_schedule_recurring_hostgroup_job(self):
:expectedresults: Scheduled Job appears in the Job Invocation list at the appointed time
"""

0 comments on commit bb58fc1

Please sign in to comment.