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 test_negative_pre_upgrade_tuning_profile_check #12578

Merged
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
1 change: 1 addition & 0 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,7 @@ class Colored(Box):
HAMMER_CONFIG = "~/.hammer/cli.modules.d/foreman.yml"
HAMMER_SESSIONS = "~/.hammer/sessions"

INSTALLER_CONFIG_FILE = '/etc/foreman-installer/scenarios.d/satellite.yaml'
SATELLITE_ANSWER_FILE = "/etc/foreman-installer/scenarios.d/satellite-answers.yaml"
CAPSULE_ANSWER_FILE = "/etc/foreman-installer/scenarios.d/capsule-answers.yaml"
MAINTAIN_HAMMER_YML = "/etc/foreman-maintain/foreman-maintain-hammer.yml"
Expand Down
23 changes: 10 additions & 13 deletions tests/foreman/maintain/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import pytest

from robottelo.config import settings
from robottelo.constants import SATELLITE_VERSION
from robottelo.constants import INSTALLER_CONFIG_FILE, SATELLITE_VERSION


def last_y_stream_version(release):
Expand Down Expand Up @@ -69,10 +69,6 @@ def test_positive_satellite_maintain_upgrade_list(sat_maintain):


@pytest.mark.include_capsule
@pytest.mark.skipif(
(settings.server.version.release == 'stream'),
reason='Upgrade path is not available for stream yet',
)
def test_positive_repositories_validate(sat_maintain):
"""Test repositories-validate pre-upgrade check is
skipped when system is subscribed using custom activationkey.
Expand Down Expand Up @@ -113,10 +109,6 @@ def test_positive_repositories_validate(sat_maintain):
ids=['default', 'medium'],
indirect=True,
)
@pytest.mark.skipif(
(settings.server.version.release == 'stream'),
reason='Upgrade path is not available for stream yet',
)
def test_negative_pre_upgrade_tuning_profile_check(request, custom_host):
"""Negative test that verifies a satellite with less than
tuning profile hardware requirements fails on pre-upgrade check.
Expand All @@ -140,11 +132,16 @@ def test_negative_pre_upgrade_tuning_profile_check(request, custom_host):
)
custom_host.download_repofile(product='satellite', release=last_y_stream)
custom_host.execute('dnf -y module enable satellite:el8 && dnf -y install satellite')
# Install without system checks to get around installer checks
# Install with development tuning profile to get around installer checks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are changing this test to use development profile the you should also handle tests parametrization ids=['default', 'medium'],

and all asserts for {profile}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny part is green PRT for this NEGATIVE test - failing on something else :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are only using the development profile to get around installer checks for system requirements like RAM and CPU cores. We have to do this in >= 6.14 because --disable-system-checks was removed. This test is still designed to make sure the default and medium profiles enforce their requirements upon an upgrade check.

custom_host.execute(
f'satellite-installer --scenario satellite --disable-system-checks --tuning {profile}',
'satellite-installer --scenario satellite --tuning development',
Gauravtalreja1 marked this conversation as resolved.
Show resolved Hide resolved
timeout='30m',
)
# Change to correct tuning profile (default or medium)
custom_host.execute(
f'sed -i "s/tuning: development/tuning: {profile}/g" {INSTALLER_CONFIG_FILE};'
f'satellite-installer'
)
# Get current Satellite version's repofile
custom_host.download_repofile(
product='satellite', release=sat_version, snap=settings.server.version.snap
Expand All @@ -154,10 +151,10 @@ def test_negative_pre_upgrade_tuning_profile_check(request, custom_host):
custom_host.execute('satellite-maintain upgrade list-versions')
# Check that we can upgrade to the new Y stream version
result = custom_host.execute('satellite-maintain upgrade list-versions')
assert sat_version in result.stdout
assert SATELLITE_VERSION in result.stdout
# Check that the upgrade check fails due to system requirements
result = custom_host.execute(
f'satellite-maintain upgrade check --target-version {sat_version}', timeout='5m'
f'satellite-maintain upgrade check --target-version {SATELLITE_VERSION}', timeout='5m'
)
assert (
f'ERROR: The installer is configured to use the {profile} tuning '
Expand Down