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

CC-client registration with capsule based on setting value #15428

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
79 changes: 79 additions & 0 deletions tests/foreman/cli/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -2683,3 +2683,82 @@ def test_positive_create_host_with_lifecycle_environment_name(
hosts = module_target_sat.cli.Host.list({'organization-id': module_org.id})
found_host = any(new_host.name in i.values() for i in hosts)
assert found_host, 'Assertion failed: host not found'


@pytest.mark.no_containers
vijaysawant marked this conversation as resolved.
Show resolved Hide resolved
@pytest.mark.rhel_ver_match('9')
@pytest.mark.parametrize(
'setting_update', ['validate_host_lce_content_source_coherence'], indirect=False
)
def test_host_registration_with_capsule_using_content_coherence(
module_target_sat,
setting_update,
module_sca_manifest_org,
module_activation_key,
rhel_contenthost,
module_capsule_configured,
):
"""Register client with capsule when settings "validate_host_lce_content_source_coherence" is set to Yes/No

:id: 17dbec62-eed4-4a51-9927-80919457a124

:Verifies: SAT-22048

:setup:
1. Create AK which is associated with the organization
2. Configure capsule with satellite

:steps:
1. Register client with capsule when settings "validate_host_lce_content_source_coherence" is set to Yes
2. Check output for "HTTP error code 422: Validation failed: Content view environment content facets is invalid"
3. Re-register client with settings "validate_host_lce_content_source_coherence" is set to No
4. Check output there should not be any error like "Validation failed" or "HTTP error code 422"

:expectedresults: Host registration success with error when settings set to Yes and Host registration success when
settings set to No

:customerscenario: true
vijaysawant marked this conversation as resolved.
Show resolved Hide resolved

:parametrized: yes

:CaseImportance: High
"""
# set a new proxy
vijaysawant marked this conversation as resolved.
Show resolved Hide resolved
module_target_sat.cli.Capsule.update(
{'name': module_capsule_configured.hostname, 'organization-ids': module_sca_manifest_org.id}
)
# Register client with capsule when settings "validate_host_lce_content_source_coherence" is set to Yes
module_target_sat.cli.Settings.set(
{'name': 'validate_host_lce_content_source_coherence', 'value': 'true'}
)
result = rhel_contenthost.register(
module_sca_manifest_org,
None,
module_activation_key.name,
module_capsule_configured,
force=True,
)
assert result.status == 0, f'Failed to register host: {result.stderr}'

# Check output for "HTTP error code 422: Validation failed: Content view environment content facets is invalid"
assert 'Validation failed' in result.stderr, f'Error is: {result.stderr}'
if rhel_contenthost.os_version.major != 7:
assert 'HTTP error code 422' in result.stderr, f'Error is: {result.stderr}'

# Re-register client with settings "validate_host_lce_content_source_coherence" is set to No
module_target_sat.cli.Settings.set(
{'name': 'validate_host_lce_content_source_coherence', 'value': 'false'}
)
result = rhel_contenthost.register(
module_sca_manifest_org,
None,
module_activation_key.name,
module_capsule_configured,
force=True,
)
assert result.status == 0, f'Failed to register host: {result.stderr}'

# Check output there should not any error like "Validation failed" or "HTTP error code 422"
assert 'Validation failed' not in result.stderr, f'Error is: {result.stderr}'
if rhel_contenthost.os_version.major != 7:
assert 'HTTP error code 422' not in result.stderr, f'Error is: {result.stderr}'