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

[6.15.z] Fail curl command registration #14266

Merged
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
37 changes: 37 additions & 0 deletions tests/foreman/api/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,40 @@ def test_positive_host_registration_with_non_admin_user_with_setup_false(
assert '# Updating packages' not in result.stdout
# verify foreman-proxy ssh pubkey isn't present when Setup REX is false
assert rhel_contenthost.execute('cat ~/.ssh/authorized_keys | grep foreman-proxy').status == 1


@pytest.mark.rhel_ver_match('[^6]')
def test_negative_verify_bash_exit_status_failing_host_registration(
module_sca_manifest_org,
module_location,
module_target_sat,
rhel_contenthost,
):
"""Verify status code, when curl command registration fail intentionally

:id: 4789e8da-6391-4ea4-aa0d-73c93220ce44

:steps:
1. Generate a curl command and make the registration fail intentionally.
2. Check the exit code for the command.

:expectedresults: Exit code returns 1 if registration fails.

:BZ: 2155444

:customerscenario: true

:parametrized: yes
"""
ak = module_target_sat.api.ActivationKey(name=gen_string('alpha')).create()
# Try registration command generated with AK not in same as selected organization
command = module_target_sat.api.RegistrationCommand(
organization=module_sca_manifest_org,
activation_keys=[ak.name],
location=module_location,
).create()
result = rhel_contenthost.execute(command)

# verify status code when registrationCommand fails to register on host
assert result.status == 1
assert 'Couldn\'t find activation key' in result.stderr
Loading