From c1d5063d644f9d8f85e049463119b1fde547f477 Mon Sep 17 00:00:00 2001 From: Peter Ondrejka Date: Thu, 23 May 2024 16:59:07 +0200 Subject: [PATCH] test timeout_to_kill --- tests/foreman/cli/test_remoteexecution.py | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/foreman/cli/test_remoteexecution.py b/tests/foreman/cli/test_remoteexecution.py index fc14a5daa6a..c4b2e3f9a78 100644 --- a/tests/foreman/cli/test_remoteexecution.py +++ b/tests/foreman/cli/test_remoteexecution.py @@ -134,6 +134,40 @@ 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 + """ + client = rex_contenthost + command = 'sleep 160' + invocation_command = module_target_sat.cli_factory.job_invocation( + { + 'job-template': 'Run Command - Script Default', + 'inputs': f'command={command}', + 'search-query': f"name ~ {client.hostname}", + 'timeout_to_kill': '5', + } + ) + sleep(10) + assert_job_invocation_status( + module_target_sat, invocation_command['id'], client.hostname, 'failed' + ) + 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