Skip to content

Commit

Permalink
rex longrun job (#14437)
Browse files Browse the repository at this point in the history
(cherry picked from commit d13439e)
  • Loading branch information
pondrejk authored and web-flow committed Apr 22, 2024
1 parent 89fa807 commit a61fed8
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
4 changes: 2 additions & 2 deletions robottelo/cli/job_invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_output(cls, options):
return cls.execute(cls._construct_command(options))

@classmethod
def create(cls, options):
def create(cls, options, timeout=None):
"""Create a job"""
cls.command_sub = 'create'
return cls.execute(cls._construct_command(options), output_format='csv')
return cls.execute(cls._construct_command(options), output_format='csv', timeout=timeout)
4 changes: 2 additions & 2 deletions robottelo/host_helpers/cli_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from robottelo.utils.manifest import clone


def create_object(cli_object, options, values=None, credentials=None):
def create_object(cli_object, options, values=None, credentials=None, timeout=None):
"""
Creates <object> with dictionary of arguments.
Expand All @@ -52,7 +52,7 @@ def create_object(cli_object, options, values=None, credentials=None):
if credentials:
cli_object = cli_object.with_user(*credentials)
try:
result = cli_object.create(options)
result = cli_object.create(options, timeout)
except CLIReturnCodeError as err:
# If the object is not created, raise exception, stop the show.
raise CLIFactoryError(
Expand Down
50 changes: 50 additions & 0 deletions tests/foreman/longrun/test_remoteexecution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Test module for Remote Execution
:Requirement: Remoteexecution
:CaseAutomation: Automated
:CaseComponent: RemoteExecution
:Team: Endeavour
:CaseImportance: High
"""
import pytest


@pytest.mark.rhel_ver_list([9])
def test_positive_run_long_job(module_org, rex_contenthost, module_target_sat):
"""Run a long running job
:id: 76934868-89e6-4eb6-905e-d0d5ededc077
:expectedresults: Verify the long job was successfully ran and not terminated too soon
:bz: 2270295
:parametrized: yes
"""
client = rex_contenthost
invocation_command = module_target_sat.cli_factory.job_invocation(
{
'job-template': 'Run Command - Script Default',
'inputs': 'command=sleep 700',
'search-query': f"name ~ {client.hostname}",
},
timeout='800s',
)
result = module_target_sat.cli.JobInvocation.info({'id': invocation_command['id']})
try:
assert result['success'] == '1'
except AssertionError as err:
raise AssertionError(
'host output: {}'.format(
' '.join(
module_target_sat.cli.JobInvocation.get_output(
{'id': invocation_command['id'], 'host': client.hostname}
)
)
)
) from err

0 comments on commit a61fed8

Please sign in to comment.