Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.15.z] bz1784254 #13801

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions tests/foreman/cli/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from dateutil.relativedelta import FR, relativedelta
from fauxfactory import gen_string
import pytest
from wait_for import wait_for

from robottelo import constants
from robottelo.config import settings
Expand Down Expand Up @@ -581,6 +582,51 @@ def test_positive_run_scheduled_job_template(self, rex_contenthost, target_sat):
sleep(30)
assert_job_invocation_result(target_sat, invocation_command['id'], client.hostname)

@pytest.mark.tier3
@pytest.mark.rhel_ver_list([8, 9])
def test_recurring_with_unreachable_host(self, module_target_sat, rhel_contenthost):
"""Run a recurring task against a host that is not reachable and verify it gets rescheduled

:id: 570f6d75-6bbf-40b0-a1df-6c26b588dca8

:expectedresults: The job is being rescheduled indefinitely even though it fails

:BZ: 1784254

:customerscenario: true

:parametrized: yes
"""
cli = module_target_sat.cli
host = module_target_sat.cli_factory.make_fake_host()
# shutdown the host and wait for it to surely be unreachable
rhel_contenthost.execute("shutdown -h +1") # shutdown after one minute
sleep(120)
invocation = module_target_sat.cli_factory.job_invocation(
{
'job-template': 'Run Command - Script Default',
'inputs': 'command=echo this wont ever run',
'search-query': f'name ~ {host.name}',
'cron-line': '* * * * *', # every minute
}
)
cli.RecurringLogic.info(
{'id': cli.JobInvocation.info({'id': invocation.id})['recurring-logic-id']}
)
# wait for the third task to be planned which verifies the BZ
wait_for(
lambda: int(
cli.RecurringLogic.info(
{'id': cli.JobInvocation.info({'id': invocation.id})['recurring-logic-id']}
)['task-count']
)
> 2,
timeout=180,
delay=10,
)
# check that the first task indeed failed which verifies the test was done correctly
assert cli.JobInvocation.info({'id': invocation.id})['failed'] != '0'


class TestAnsibleREX:
"""Test class for remote execution via Ansible"""
Expand Down