diff --git a/robottelo/cli/sm_upgrade.py b/robottelo/cli/sm_upgrade.py index a30e1582182..3c4c35fc0a6 100644 --- a/robottelo/cli/sm_upgrade.py +++ b/robottelo/cli/sm_upgrade.py @@ -7,7 +7,6 @@ [ARG] ... subcommand arguments Subcommands: - list-versions List versions this system is upgradable to check Run pre-upgrade checks before upgrading to specified version run Run full upgrade to a specified version @@ -23,13 +22,6 @@ class Upgrade(Base): command_base = 'upgrade' - @classmethod - def list_versions(cls, options=None, env_var=None): - """Build satellite-maintain upgrade list-versions""" - cls.command_sub = 'list-versions' - options = options or {} - return cls.sm_execute(cls._construct_command(options), env_var=env_var) - @classmethod def check(cls, options=None, env_var=None): """Build satellite-maintain upgrade check""" diff --git a/tests/foreman/maintain/test_upgrade.py b/tests/foreman/maintain/test_upgrade.py index 555921d52be..5e4939bb85a 100644 --- a/tests/foreman/maintain/test_upgrade.py +++ b/tests/foreman/maintain/test_upgrade.py @@ -28,42 +28,6 @@ def last_y_stream_version(release): return f"{release.split('.')[0]}.{y_minus}" -@pytest.mark.e2e -@pytest.mark.include_capsule -def test_positive_satellite_maintain_upgrade_list(sat_maintain): - """List versions this system is upgradable to - - :id: 12efec41-4f09-4199-a20c-a4525e773b78 - - :parametrized: yes - - :steps: - 1. Run satellite-maintain upgrade list-versions - - :expectedresults: Versions system is upgradable to are listed. - """ - xy_version = '.'.join(sat_maintain.version.split('.')[:2]) - previous_xy_version = '.'.join( - [xy_version.split('.')[0], str(int(xy_version.split('.')[1]) - 1)] - ) - if sat_maintain.version.startswith(xy_version): - versions = [f'{xy_version}.z'] - elif sat_maintain.version.startswith(previous_xy_version): - versions = [f'{previous_xy_version}.z', xy_version] - else: - versions = ['Unsupported Satellite/Capsule version'] - - # Reboot if needed - if sat_maintain.execute('needs-restarting -r').status == 1: - sat_maintain.power_control(state='reboot') - - result = sat_maintain.cli.Upgrade.list_versions() - assert result.status == 0 - assert 'FAIL' not in result.stdout - for ver in versions: - assert ver in result.stdout - - @pytest.mark.include_capsule def test_positive_repositories_validate(sat_maintain): """Test repositories-validate pre-upgrade check is @@ -162,8 +126,8 @@ def test_positive_self_update_maintain_package(sat_maintain): :parametrized: yes :steps: - 1. Run satellite-maintain upgrade list-versions/check/run command. - 2. Run satellite-maintain upgrade list-versions/check/run command + 1. Run satellite-maintain update check command. + 2. Run satellite-maintain update check command with disable-self-upgrade option. :expectedresults: @@ -172,10 +136,17 @@ def test_positive_self_update_maintain_package(sat_maintain): :BZ: 1649329 """ - result = sat_maintain.cli.Upgrade.list_versions() + result = sat_maintain.cli.Update.check( + options={'whitelist': 'repositories-validate, non-rh-packages'} + ) assert result.status == 0 assert 'Checking for new version of satellite-maintain...' in result.stdout - result = sat_maintain.cli.Upgrade.list_versions(options={'disable-self-upgrade': True}) + result = sat_maintain.cli.Update.check( + options={ + 'whitelist': 'repositories-validate, non-rh-packages', + 'disable-self-upgrade': True, + } + ) assert result.status == 0 assert 'Checking for new version of satellite-maintain...' not in result.stdout @@ -216,8 +187,8 @@ def test_positive_check_presence_satellite_or_satellite_capsule(sat_maintain): :parametrized: yes :steps: - 1. Run satellite-maintain upgrade list-versions/check/run command. - 2. Run satellite-maintain upgrade list-versions/check/run command, + 1. Run satellite-maintain upgrade check/run command. + 2. Run satellite-maintain upgrade check/run command, after removing satellite and satellite-capsule packages. :expectedresults: diff --git a/tests/upgrades/test_satellite_maintain.py b/tests/upgrades/test_satellite_maintain.py deleted file mode 100644 index 128a6dd64b2..00000000000 --- a/tests/upgrades/test_satellite_maintain.py +++ /dev/null @@ -1,71 +0,0 @@ -"""satellite-maintain Upgrade Scenarios - -:Requirement: UpgradedSatellite - -:CaseAutomation: Automated - -:CaseComponent: SatelliteMaintain - -:Team: Platform - -:CaseImportance: High - -""" - -import re - -import pytest - - -class TestSatelliteMaintain: - """Pre-upgrade and post-upgrade scenarios to test satellite-maintain utility. - - Test Steps: - 1. Before Satellite upgrade, Perform test for "satellite-maintain upgrade list-versions" - 2. Upgrade satellite/capsule. - 3. Perform tests for satellite-maintain upgrade list-versions, after upgrade. - 4. Check if tests passed. - """ - - @staticmethod - def satellite_upgradable_version_list(sat_obj): - """Obtain upgradable version list by satellite-maintain. - - :return: upgradeable_versions - """ - cmd = 'satellite-maintain upgrade list-versions --disable-self-upgrade' - list_versions = sat_obj.execute(cmd).stdout - regex = re.compile(r'^\d+\.\d+') - return [version for version in list_versions if regex.match(version)] - - @pytest.mark.pre_upgrade - def test_pre_satellite_maintain_upgrade_list_versions(self, target_sat): - """Test list of satellite target versions before upgrade. - - :id: preupgrade-fc2c54b2-2663-11ea-b47c-48f17f1fc2e1 - - :steps: - 1. Run satellite-maintain upgrade list-versions - - :expectedresults: Versions should be current z-stream. - """ - zstream = '.'.join(target_sat.version.split('.')[0:2]) + '.z' - upgradable_versions = self.satellite_upgradable_version_list(target_sat) - # only possible target should be appropriate zstream - assert set(upgradable_versions) - {zstream} == set() - - @pytest.mark.post_upgrade - def test_post_satellite_maintain_upgrade_list_versions(self, target_sat): - """Test list of satellite target versions after upgrade. - - :id: postupgrade-0bce689c-2664-11ea-b47c-48f17f1fc2e1 - - :steps: - 1. Run satellite-maintain upgrade list-versions. - - :expectedresults: Versions should be next z-stream. - """ - zstream = '.'.join(target_sat.version.split('.')[0:2]) + '.z' - upgradable_versions = self.satellite_upgradable_version_list(target_sat) - # only possible target should be appropriate zstream - assert set(upgradable_versions) - {zstream} == set()