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

Add test for host registration using capsule cname #15629

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shweta83
Copy link
Contributor

@shweta83 shweta83 commented Jul 11, 2024

Add test for host registration using capsule cname.
BZ#2158959

Related Issues

@shweta83 shweta83 requested a review from a team as a code owner July 11, 2024 09:42
@shweta83 shweta83 added CherryPick PR needs CherryPick to previous branches AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing 6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 labels Jul 11, 2024
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/api/test_registration.py -k test_positive_register_host_with_capsule_cname

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7712
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_registration.py -k test_positive_register_host_with_capsule_cname --external-logging
Test Result : ========== 16 deselected, 69 warnings, 2 errors in 1361.83s (0:22:41) ==========

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Jul 11, 2024
@jyejare jyejare added the 6.16.z Introduced in or relating directly to Satellite 6.16 label Aug 22, 2024
@shweta83
Copy link
Contributor Author

shweta83 commented Sep 3, 2024

trigger: test-robottelo
pytest: tests/foreman/api/test_registration.py -k test_positive_register_host_with_capsule_cname

@shweta83 shweta83 marked this pull request as draft September 3, 2024 13:27
@shweta83 shweta83 force-pushed the host_register_capsule_cname branch 2 times, most recently from e2359fa to 20668ca Compare September 3, 2024 13:36
@shweta83
Copy link
Contributor Author

shweta83 commented Sep 3, 2024

trigger: test-robottelo
pytest: tests/foreman/api/test_registration.py -k test_positive_register_host_with_capsule_cname

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 8448
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_registration.py -k test_positive_register_host_with_capsule_cname --external-logging
Test Result : ===== 2 failed, 18 deselected, 77 warnings, 2 errors in 1449.10s (0:24:09) =====

@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/api/test_registration.py -k test_positive_register_host_with_capsule_cname

@shweta83 shweta83 marked this pull request as ready for review September 17, 2024 12:45
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 8677
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_registration.py -k test_positive_register_host_with_capsule_cname --external-logging
Test Result : ========== 2 passed, 18 deselected, 88 warnings in 1550.69s (0:25:50) ==========

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Sep 17, 2024
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Sep 18, 2024
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/api/test_registration.py -k test_positive_register_host_with_capsule_cname

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 8687
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_registration.py -k test_positive_register_host_with_capsule_cname --external-logging
Test Result : ========= 2 passed, 18 deselected, 107 warnings in 1909.47s (0:31:49) ==========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Sep 18, 2024
Comment on lines +508 to +510
result = rhel_contenthost.execute(
re.sub(r"https://ip.*?redhat\.com", f'https://{capsule_cname}', command)
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why hardcoding the url? could you try something similar,

Suggested change
result = rhel_contenthost.execute(
re.sub(r"https://ip.*?redhat\.com", f'https://{capsule_cname}', command)
)
result = rhel_contenthost.execute(
command.replace(module_capsule_configured.hostname, capsule_cname)
)

Comment on lines +494 to +498
rhel_contenthost.execute(
f'echo "{module_capsule_configured.ip} {module_capsule_configured.hostname} {capsule_cname}'
f'" >> /etc/hosts'
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there any direct way from smart_proxy to handle setting the cname's?


:parametrized: yes
"""
capsule_cname = "capsule.example.com"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
capsule_cname = "capsule.example.com"
capsule_cname = 'capsule.example.com'

@@ -445,3 +446,66 @@ def test_positive_katello_ca_crt_refresh(
# check if the certificate file is refreshed
ca_file_after_refresh = len(str(rhel_contenthost.execute(f'cat {katello_ca_crt_path}')))
assert ca_cert_file == ca_file_after_refresh


@pytest.mark.rhel_ver_match('[^7]')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really required to run for all rhel versions? I feel default should be suffice to test

module_activation_key,
module_capsule_configured,
):
"""Verify host registration works with proxy and proxy_cname
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're just testing with proxy_cname here, right?

Comment on lines +481 to +483
nc = module_capsule_configured.nailgun_smart_proxy
module_target_sat.api.SmartProxy(id=nc.id, organization=[org]).update(['organization'])
module_target_sat.api.SmartProxy(id=nc.id, location=[module_location]).update(['location'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both updates can be done in same call

Suggested change
nc = module_capsule_configured.nailgun_smart_proxy
module_target_sat.api.SmartProxy(id=nc.id, organization=[org]).update(['organization'])
module_target_sat.api.SmartProxy(id=nc.id, location=[module_location]).update(['location'])
nc = module_capsule_configured.nailgun_smart_proxy
nc.location = [module_location]
nc.organization = [module_org]
nc.update(['organization', 'location'])

:id: 86b5c329-7784-43f4-bb67-67ce5a24ce17

:steps:
1. Get a configure capsule registered with Satellite.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Get a configure capsule registered with Satellite.
1. Configure external capsule which is registered to Satellite


:steps:
1. Get a configure capsule registered with Satellite.
2. Verify Host registers to Capsule successfully.
Copy link
Collaborator

@Gauravtalreja1 Gauravtalreja1 Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Host or Capsule? anyway this step can be skipped

Copy link

This pull request has not been updated in the past 45 days.

@github-actions github-actions bot added the Stale Stale issue or Pull Request label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 6.16.z Introduced in or relating directly to Satellite 6.16 AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing CherryPick PR needs CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR Stale Stale issue or Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants