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 f56e68c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 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
13 changes: 13 additions & 0 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,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 settings.server.version.rhel_version != 9:
assert (
self.execute(
f"dnf -y module enable {self.product_rpm_name}:el{settings.server.version.rhel_version}"
).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
5 changes: 4 additions & 1 deletion tests/foreman/destructive/test_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ 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
if settings.server.version.rhel_version != 9:
assert (
sat_ready_rhel.execute(f'dnf module enable -y satellite:el{rhel_version}').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
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

0 comments on commit f56e68c

Please sign in to comment.