Skip to content

Commit

Permalink
test timeout_to_kill (#15162)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1628759)
  • Loading branch information
pondrejk authored and Gauravtalreja1 committed Aug 7, 2024
1 parent 98e258b commit e4e45b8
Showing 1 changed file with 45 additions and 0 deletions.
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

0 comments on commit e4e45b8

Please sign in to comment.