Skip to content

Commit

Permalink
CC-client registration with capsule based on setting value (Satellite…
Browse files Browse the repository at this point in the history
…QE#15428)

* client registration with capsule based on setting value

* client registration with capsule based on setting value, fixed error

* worked on minor review comments

* bypass assertion for rhel7 version

* resolve issue, which bypass rhel7 version

* used module level fixture instead of function level
  • Loading branch information
vijaysawant authored and jyejare committed Oct 19, 2024
1 parent 66407fc commit 4207888
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions tests/foreman/cli/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -2731,3 +2731,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
@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
:parametrized: yes
:CaseImportance: High
"""
# set a new proxy
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}'

0 comments on commit 4207888

Please sign in to comment.