Skip to content

Commit

Permalink
fix in alternate directory rex test
Browse files Browse the repository at this point in the history
  • Loading branch information
pondrejk committed Dec 7, 2022
1 parent 10189de commit 312ffc2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
5 changes: 4 additions & 1 deletion robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ def register(
insecure=True,
username=settings.server.admin_username,
password=settings.server.admin_password,
port='9090',
):
"""Registers content host to the Satellite or Capsule server
using a global registration template.
Expand All @@ -548,6 +549,7 @@ def register(
:param insecure: Don't verify server authenticity.
:param username: Satellite admin username
:param password: Satellite admin password
:param port: Capsule port, if unset template is pulled straight from Satellite
:return: SSHCommandResult instance filled with the result of the
registration.
"""
Expand Down Expand Up @@ -586,11 +588,12 @@ def register(
if repo_gpg_key_url is not None
else ''
)
port = f':{port}' if port is not None else ''
cmd = (
'curl -sS '
f'-u {username}:{password} '
f'{"--insecure " if insecure else ""}'
f"'https://{target.hostname}:9090/register?"
f"'https://{target.hostname}{port}/register?"
f'activation_keys={activation_keys}'
f'&organization_id={org.id}'
f'&location_id={loc.id}'
Expand Down
19 changes: 16 additions & 3 deletions tests/foreman/destructive/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ def test_negative_run_capsule_upgrade_playbook_on_satellite(target_sat):
assert 'This playbook cannot be executed on a Satellite server.' in response.text


@pytest.mark.rhel_ver_list([7])
def test_positive_use_alternate_directory(rex_contenthost, target_sat):
@pytest.mark.no_containers
@pytest.mark.rhel_ver_list([8])
def test_positive_use_alternate_directory(
rhel_contenthost, target_sat, default_org, default_location
):
"""Use alternate working directory on client to execute rex jobs
:id: a0181f18-d3dc-4bd9-a2a6-430c2a49809e
Expand All @@ -90,7 +93,17 @@ def test_positive_use_alternate_directory(rex_contenthost, target_sat):
:parametrized: yes
"""
client = rex_contenthost
client = rhel_contenthost
ak = target_sat.cli_factory.make_activation_key(
{
'lifecycle-environment': 'Library',
'content-view': 'Default Organization View',
'organization-id': default_org.id,
'auto-attach': False,
}
)
result = client.register(target_sat, default_org, default_location, ak.name, port=None)
assert result.status == 0, f'Failed to register host: {result.stderr}'
testdir = gen_string('alpha')
result = client.run(f'mkdir /{testdir}')
assert result.status == 0
Expand Down

0 comments on commit 312ffc2

Please sign in to comment.