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

rex longrun job #14437

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
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
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
Loading