Skip to content

Commit

Permalink
Fix tests failing on enabling satellite/capsule module
Browse files Browse the repository at this point in the history
  • Loading branch information
jameerpathan111 committed Apr 8, 2024
1 parent f1799c9 commit 7677afc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
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 @@ -346,7 +346,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
9 changes: 9 additions & 0 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,15 @@ 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.
"""
enable_module_cmd = f"dnf -y module enable {self.product_rpm_name}:el{settings.server.version.rhel_version} && "
if settings.server.version.rhel_version == 9:
enable_module_cmd = ""
return self.execute(f"{enable_module_cmd} dnf -y install {self.product_rpm_name}")


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
assert sat_ready_rhel.install_satellite_or_capsule_package.status == 0
# 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
4 changes: 1 addition & 3 deletions tests/foreman/sys/test_katello_certs_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +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'
)
result = sat_ready_rhel.install_satellite_or_capsule_package()
assert result.status == 0
command = InstallerCommand(
scenario='satellite',
Expand Down

0 comments on commit 7677afc

Please sign in to comment.