Skip to content

Commit

Permalink
improve installer tests compatibility with pit (#15308)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmynar committed Sep 20, 2024
1 parent 19fdde7 commit ac5c8aa
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 40 deletions.
2 changes: 1 addition & 1 deletion conf/capsule.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CAPSULE:
# The snap version currently testing (if applicable)
# SNAP:
# The source of Capsule packages. Can be one of:
# internal, ga, beta
# internal, ga
SOURCE: "internal"
# The base os rhel version where the capsule installed
# RHEL_VERSION:
Expand Down
3 changes: 3 additions & 0 deletions conf/robottelo.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ ROBOTTELO:
- '6.17'
# The Base OS RHEL Version(x.y) where the satellite would be installed
RHEL_VERSION: "8.10"
# The source of RHEL packages. Can be one of:
# internal, ga (CDN)
RHEL_SOURCE: "ga"
# Dynaconf and Dynaconf hooks related options
SETTINGS:
GET_FRESH: true
Expand Down
8 changes: 4 additions & 4 deletions conf/server.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ SERVER:
# - replace.with.satellite.hostname
# - replace.with.satellite.hostname
VERSION:
# The full release version (6.9.2)
RELEASE: 6.9.2
# The full release version (6.15.0)
RELEASE: 6.15.0
# The snap version currently testing (if applicable)
SNAP: 1.0
# The source of Satellite packages. Can be one of:
# internal, ga, beta
# internal, ga
SOURCE: "internal"
# The RHEL Base OS Version(x.y) where the Satellite is installed
RHEL_VERSION: '7'
RHEL_VERSION: '8'
# If the the satellite server is IPv6 server
IS_IPV6: False
# HTTP Proxy url for IPv6 satellite to connect for outer world access
Expand Down
32 changes: 24 additions & 8 deletions pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,15 @@ def sat_ready_rhel(request):
@pytest.fixture(scope='module')
def module_sat_ready_rhels(request):
deploy_args = get_deploy_args(request)
with Broker(**deploy_args, host_class=Satellite, _count=2) as hosts:
with Broker(**deploy_args, host_class=Satellite, _count=3) as hosts:
yield hosts


@pytest.fixture
def cap_ready_rhel():
"""Deploy bare RHEL system ready for Capsule installation."""
rhel_version = Version(settings.capsule.version.rhel_version)
deploy_args = {
deploy_args = settings.capsule.deploy_arguments | {
'deploy_rhel_version': rhel_version.base_version,
'deploy_network_type': 'ipv6' if settings.server.is_ipv6 else 'ipv4',
'deploy_flavor': settings.flavors.default,
Expand All @@ -356,13 +357,28 @@ def installer_satellite(request):
else:
sat = lru_sat_ready_rhel(getattr(request, 'param', None))
sat.setup_firewall()
# # Register for RHEL8 repos, get Ohsnap repofile, and enable and download satellite

# register to cdn (also enables rhel repos from cdn)
sat.register_to_cdn(enable_proxy=True)
sat.download_repofile(
product='satellite',
release=settings.server.version.release,
snap=settings.server.version.snap,
)

# setup source repositories
if settings.server.version.source == "ga":
# enable satellite repos
for repo in sat.SATELLITE_CDN_REPOS.values():
sat.enable_repo(repo, force=True)
else:
# get ohsnap repofile
sat.download_repofile(
product='satellite',
release=settings.server.version.release,
snap=settings.server.version.snap,
)
if settings.robottelo.rhel_source == "internal":
# disable rhel repos from cdn
sat.disable_repo("rhel-*")
# add internal rhel repos
sat.create_custom_repos(**settings.repos.get(f'rhel{sat.os_version.major}_os'))

sat.install_satellite_or_capsule_package()
# Install Satellite
sat.execute(
Expand Down
5 changes: 3 additions & 2 deletions robottelo/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Validator('server.hostname', is_type_of=str),
Validator('server.hostnames', must_exist=True, is_type_of=list),
Validator('server.version.release', must_exist=True),
Validator('server.version.source', must_exist=True),
Validator('server.version.source', default='internal', is_in=['internal', 'ga']),
Validator('server.version.rhel_version', must_exist=True, cast=str),
Validator(
'server.xdist_behavior', must_exist=True, is_in=['run-on-one', 'balance', 'on-demand']
Expand Down Expand Up @@ -79,7 +79,7 @@
],
capsule=[
Validator('capsule.version.release', must_exist=True),
Validator('capsule.version.source', must_exist=True),
Validator('capsule.version.source', default='internal', is_in=['internal', 'ga']),
Validator('capsule.deploy_workflows', must_exist=True, is_type_of=dict),
Validator('capsule.deploy_workflows.product', must_exist=True),
Validator('capsule.deploy_workflows.os', must_exist=True),
Expand Down Expand Up @@ -322,6 +322,7 @@
default=[],
cast=lambda x: list(map(str, x)),
),
Validator('robottelo.rhel_source', default='ga', is_in=['ga', 'internal']),
],
shared_function=[
Validator('shared_function.storage', is_in=('file', 'redis'), default='file'),
Expand Down
16 changes: 16 additions & 0 deletions robottelo/host_helpers/contenthost_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ def REPOS(self):
except KeyError as err:
raise ValueError(f'Unsupported system version: {self._v_major}') from err

@cached_property
def SATELLITE_CDN_REPOS(self):
sat_version = ".".join(settings.server.version.release.split('.')[0:2])
return {
'satellite': f"satellite-{sat_version}-for-rhel-{self._v_major}-x86_64-rpms",
'sat-maintenance': f"satellite-maintenance-{sat_version}-for-rhel-{self._v_major}-x86_64-rpms",
}

@cached_property
def CAPSULE_CDN_REPOS(self):
sat_version = ".".join(settings.server.version.release.split('.')[0:2])
return {
'capsule': f"satellite-capsule-{sat_version}-for-rhel-{self._v_major}-x86_64-rpms",
'sat-maintenance': f"satellite-maintenance-{sat_version}-for-rhel-{self._v_major}-x86_64-rpms",
}

@cached_property
def OSCAP(self):
return {
Expand Down
6 changes: 5 additions & 1 deletion robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@

@lru_cache
def lru_sat_ready_rhel(rhel_ver):
"""Deploy bare RHEL system ready for Satellite installation."""
rhel_version = rhel_ver or settings.server.version.rhel_version
deploy_args = {
deploy_args = settings.server.deploy_arguments | {
'deploy_rhel_version': rhel_version,
'deploy_network_type': 'ipv6' if settings.server.is_ipv6 else 'ipv4',
'deploy_flavor': settings.flavors.default,
Expand Down Expand Up @@ -525,6 +526,9 @@ def enable_repo(self, repo, force=False):
return self.execute(f'subscription-manager repos --enable {repo}')
return None

def disable_repo(self, repo):
return self.execute(f'subscription-manager repos --disable {repo}')

def subscription_manager_list_repos(self):
return self.execute('subscription-manager repos --list')

Expand Down
Loading

0 comments on commit ac5c8aa

Please sign in to comment.