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] test timeout_to_kill #15821

Closed
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
45 changes: 45 additions & 0 deletions tests/foreman/cli/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,51 @@ def test_positive_run_default_job_template(
assert 'Exit' in out
assert 'Internal Server Error' not in out

@pytest.mark.tier3
@pytest.mark.rhel_ver_list([8])
def test_positive_timeout_to_kill(self, module_org, rex_contenthost, module_target_sat):
"""Use timeout to kill setting to cancel the job

:id: 580f886b-ac24-4afa-9aca-e9afc5cfdc9c

:expectedresults: Verify the job was killed after specified times

:parametrized: yes

:Verifies: SAT-25243
"""
client = rex_contenthost
command = r'for run in {1..160}; do sleep 1; done'
template_id = (
module_target_sat.api.JobTemplate()
.search(query={'search': 'name="Run Command - Script Default"'})[0]
.id
)
invocation_command = module_target_sat.api.JobInvocation().run(
synchronous=False,
data={
'job_template_id': template_id,
'organization': module_org.name,
'inputs': {
'command': command,
},
'search_query': f'name = {client.hostname}',
'targeting_type': 'static_query',
'execution_timeout_interval': '5',
},
)
sleep(10)
result = module_target_sat.api.JobInvocation(id=invocation_command['id']).read()
assert result.failed == 1
out = module_target_sat.cli.JobInvocation.get_output(
{
'id': invocation_command['id'],
'host': client.hostname,
'organization-id': module_org.id,
}
)
assert 'Timeout for execution passed, trying to stop the job' in out

@pytest.mark.tier3
@pytest.mark.pit_client
@pytest.mark.pit_server
Expand Down