Skip to content
Merged
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
Member

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
Member

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
Member

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?

Copy link
Member

Choose a reason for hiding this comment

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

@dosas For the test ID: simply generate a new UUID. See https://github.com/SatelliteQE/robottelo/wiki/Robottelo-Contributing-Guidelines#required-docstring-content

To ensure the content is already on the host:

  1. ensure that the host already has required tooling installed or
  2. Write a fixture, register the host, enable repositories if needed, install tooling, unregister the host.

Our hosts already have both tools installed, however I do not like the fact that they come with pre-installed, non-default packages. In my view, robottelo should assume a host with a minimal installation. By minimal installation, I mean either the Minimal Install or Core package groups (dnf group info "Core"). I would prefer going with 2., however it is not ideal to register twice per test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ogajduse I fixed the uuid.

If we go with option 1. it should already be possible to run the PRT on this test?

tests/foreman/cli/test_registration.py::test_positive_register_download_utility

would you mind triggering it?


self._satellite = target.satellite
if auth_username and auth_password:
Expand Down
33 changes: 33 additions & 0 deletions tests/foreman/cli/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,39 @@ 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.

:id: 80c3204a-7923-4c70-b7c1-7b368c61d4b8

: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