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

Fix tests failing on enabling satellite/capsule module #14676

Merged
merged 1 commit into from
Apr 11, 2024
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
2 changes: 1 addition & 1 deletion pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def installer_satellite(request):
release=settings.server.version.release,
snap=settings.server.version.snap,
)
sat.execute('dnf -y module enable satellite:el8 && dnf -y install satellite')
sat.install_satellite_or_capsule_package()
installed_version = sat.execute('rpm --query satellite').stdout
assert sat_version in installed_version
# Install Satellite
Expand Down
13 changes: 13 additions & 0 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,19 @@ def cli(self):
self._cli._configured = True
return self._cli

def install_satellite_or_capsule_package(self):
"""Install Satellite/Capsule package.
Note: Make sure required repos are enabled before using this.
"""
if self.os_version.major == 8:
assert (
self.execute(
f'dnf -y module enable {self.product_rpm_name}:el{self.os_version.major}'
).status
== 0
)
assert self.execute(f'dnf -y install {self.product_rpm_name}').status == 0


class Satellite(Capsule, SatelliteMixins):
product_rpm_name = 'satellite'
Expand Down
2 changes: 1 addition & 1 deletion tests/foreman/destructive/test_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_positive_clone_backup(
for repo in getattr(constants, f"OHSNAP_RHEL{rhel_version}_REPOS"):
sat_ready_rhel.enable_repo(repo, force=True)
# Enabling satellite module
assert sat_ready_rhel.execute(f'dnf module enable -y satellite:el{rhel_version}').status == 0
sat_ready_rhel.install_satellite_or_capsule_package()
# Install satellite-clone
assert sat_ready_rhel.execute('yum install satellite-clone -y').status == 0
# Disabling CDN repos as we install from dogfdood
Expand Down
6 changes: 2 additions & 4 deletions tests/foreman/installer/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ def install_satellite(satellite, installer_args, enable_fapolicyd=False):
satellite.execute('dnf -y install fapolicyd && systemctl enable --now fapolicyd').status
== 0
)
satellite.execute('dnf -y module enable satellite:el8 && dnf -y install satellite')
satellite.install_satellite_or_capsule_package()
if enable_fapolicyd:
assert satellite.execute('rpm -q foreman-fapolicyd').status == 0
assert satellite.execute('rpm -q foreman-proxy-fapolicyd').status == 0
Expand Down Expand Up @@ -1441,9 +1441,7 @@ def test_capsule_installation(sat_non_default_install, cap_ready_rhel, setting_u
).status
== 0
)
cap_ready_rhel.execute(
'dnf -y module enable satellite-capsule:el8 && dnf -y install satellite-capsule'
)
cap_ready_rhel.install_satellite_or_capsule_package()
assert cap_ready_rhel.execute('rpm -q foreman-proxy-fapolicyd').status == 0
# Setup Capsule
setup_capsule(sat_non_default_install, cap_ready_rhel, org)
Expand Down
5 changes: 1 addition & 4 deletions tests/foreman/sys/test_katello_certs_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ def test_positive_install_sat_with_katello_certs(certs_data, sat_ready_rhel):
)
sat_ready_rhel.register_to_cdn()
sat_ready_rhel.execute('dnf -y update')
result = sat_ready_rhel.execute(
'dnf -y module enable satellite:el8 && dnf -y install satellite'
)
assert result.status == 0
sat_ready_rhel.install_satellite_or_capsule_package()
command = InstallerCommand(
scenario='satellite',
certs_server_cert=f'/root/{certs_data["cert_file_name"]}',
Expand Down