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

[6.14.z] Installer Assertions in test context rather than in helper (#15461) #15466

Merged
merged 1 commit into from
Jun 20, 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
5 changes: 1 addition & 4 deletions pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ def installer_satellite(request):
:params request: A pytest request object and this fixture is looking for
broker object of class satellite
"""
sat_version = settings.server.version.release
if 'sanity' in request.config.option.markexpr:
sat = Satellite(settings.server.hostname)
else:
Expand All @@ -346,9 +345,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')
installed_version = sat.execute('rpm --query satellite').stdout
assert sat_version in installed_version
sat.install_satellite_or_capsule_package()
# Install Satellite
sat.execute(
InstallerCommand(
Expand Down
19 changes: 19 additions & 0 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,25 @@ def cli(self):
self._cli._configured = True
return self._cli

def enable_satellite_or_capsule_module_for_rhel8(self):
"""Enable Satellite/Capsule module for RHEL8.
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
)

def install_satellite_or_capsule_package(self):
"""Install Satellite/Capsule package. Also handles module enablement for RHEL8.
Note: Make sure required repos are enabled before using this.
"""
self.enable_satellite_or_capsule_module_for_rhel8()
assert self.execute(f'dnf -y install {self.product_rpm_name}').status == 0


class Satellite(Capsule, SatelliteMixins):
product_rpm_name = 'satellite'
Expand Down
Loading