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 possibility to specify download-utility #16912

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ def register(
hostgroup=None,
auth_username=None,
auth_password=None,
download_utility=None,
):
"""Registers content host to the Satellite or Capsule server
using a global registration template.
Expand Down Expand Up @@ -704,6 +705,8 @@ def register(
options['ignore-subman-errors'] = str(ignore_subman_errors).lower()
if force:
options['force'] = str(force).lower()
if download_utility is not None:
options['download-utility'] = download_utility
Comment on lines +708 to +709
Copy link
Collaborator

Choose a reason for hiding this comment

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

@dosas Do you intent to add some test to cover this option?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Obviously I did not intent to ;) but if you point me in the right direction I can add a test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure, this tests can be added to any of tests/foreman/{api,cli,ui}/test_registration.py, and you can check of any e2e marked tests present in this modules for reference.

Copy link
Collaborator Author

@dosas dosas Jan 7, 2025

Choose a reason for hiding this comment

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

@Gauravtalreja1 I thought you were talking about a test in tests/robottelo ...

I doubt that we can add a meaningful e2e test for this on rhel operating systems because this option was specifically added for debian based operating systems where instead of curl wget is installed on default.

Or are you talking about a test where we just set the option explicitly to curl?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dosas yes, I get that, but I meant like we've option to install wget first on rhel/centos as part of test setup, then running a registration command with download_utility=wget

Copy link
Collaborator Author

@dosas dosas Feb 6, 2025

Choose a reason for hiding this comment

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

@Gauravtalreja1 I have added a test but I have no idea how (and where in the setup) I can install a package on an unregistered contenthost? Could you give me a hint?

Also which ID should I use for the new test?


self._satellite = target.satellite
if auth_username and auth_password:
Expand Down
31 changes: 31 additions & 0 deletions tests/foreman/cli/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,37 @@ def test_positive_global_registration_with_gpg_repo(
assert rhel_contenthost.execute('dnf install -y bear').status == 0


@pytest.mark.upgrade
@pytest.mark.no_containers
@pytest.mark.rhel_ver_list([settings.content_host.default_rhel_version])
@pytest.mark.parametrize('download_utility', ['wget', 'curl'])
def test_positive_register_download_utility(
module_sca_manifest_org,
module_location,
module_activation_key,
module_target_sat,
rhel_contenthost,
download_utility,
):
"""Verify host registration command gets generated and host is registered successfully with all supported download utilities.

:steps:
1. Register host with global registration template using different download utilities.

:expectedresults: Host is successfully registered.
"""
org = module_sca_manifest_org
result = rhel_contenthost.register(
org,
module_location,
module_activation_key.name,
module_target_sat,
download_utility=download_utility,
)
assert result.status == 0
assert rhel_contenthost.subscribed


@pytest.mark.parametrize('setting_update', ['default_location_subscribed_hosts'], indirect=True)
@pytest.mark.rhel_ver_list([settings.content_host.default_rhel_version])
def test_positive_verify_default_location_for_registered_host(
Expand Down
Loading