Skip to content

Commit

Permalink
[6.12] fixing a forgotten make_job_invocaiton call (#13707)
Browse files Browse the repository at this point in the history
fixing a forgotten make_job_invocaiton call
  • Loading branch information
pondrejk authored Jan 10, 2024
1 parent 8d1eae9 commit 7eae7ab
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions tests/foreman/cli/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,6 @@ def test_positive_run_job_on_host_registered_to_pull_provider(
module_ak_with_cv,
module_capsule_configured_mqtt,
rhel_contenthost,
target_sat,
):
"""Run custom template on host registered to mqtt
Expand Down Expand Up @@ -1080,13 +1079,44 @@ def test_positive_run_job_on_host_registered_to_pull_provider(
result = rhel_contenthost.execute('yggdrasil status')
assert result.status == 0, f'Failed to start yggdrasil on client: {result.stderr}'
# run script provider rex command
invocation_command = target_sat.cli_factory.job_invocation(
invocation_command = module_target_sat.cli_factory.job_invocation(
{
'job-template': 'Service Action - Script Default',
'inputs': 'action=status, service=yggdrasild',
'search-query': f"name ~ {rhel_contenthost.hostname}",
}
)
assert_job_invocation_result(
target_sat, invocation_command['id'], rhel_contenthost.hostname
module_target_sat, invocation_command['id'], rhel_contenthost.hostname
)
# create user on host
username = gen_string('alpha')
filename = gen_string('alpha')
make_user_job = module_target_sat.cli_factory.job_invocation(
{
'job-template': 'Run Command - Script Default',
'inputs': f"command=useradd -m {username}",
'search-query': f"name ~ {rhel_contenthost.hostname}",
}
)
assert_job_invocation_result(
module_target_sat, make_user_job['id'], rhel_contenthost.hostname
)
# create a file as new user
invocation_command = module_target_sat.cli_factory.job_invocation(
{
'job-template': 'Run Command - Script Default',
'inputs': f"command=touch /home/{username}/{filename}",
'search-query': f"name ~ {rhel_contenthost.hostname}",
'effective-user': f'{username}',
}
)
assert_job_invocation_result(
module_target_sat, invocation_command['id'], rhel_contenthost.hostname
)
# check the file owner
result = rhel_contenthost.execute(
f'''stat -c '%U' /home/{username}/{filename}''',
)
# assert the file is owned by the effective user
assert username == result.stdout.strip('\n')

0 comments on commit 7eae7ab

Please sign in to comment.