From 8f03eaf9155a6c62cf185bce2c092bb57905606c Mon Sep 17 00:00:00 2001 From: Griffin Sullivan <48397354+Griffin-Sullivan@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:24:33 -0400 Subject: [PATCH] Assert no version available on satellite-maintain upgrade list-versions for stream (#12289) Assert no version available on upgrade list-versions for stream --- tests/foreman/maintain/test_upgrade.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/foreman/maintain/test_upgrade.py b/tests/foreman/maintain/test_upgrade.py index ed378096913..dd27db6577e 100644 --- a/tests/foreman/maintain/test_upgrade.py +++ b/tests/foreman/maintain/test_upgrade.py @@ -16,6 +16,8 @@ :Upstream: No """ +import re + import pytest from robottelo.config import settings @@ -58,11 +60,19 @@ def test_positive_satellite_maintain_upgrade_list(sat_maintain): 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 + # If on stream, check there is no version listed + if sat_maintain.is_stream: + assert not bool(re.search(r'\d', result.stdout)) + else: + for ver in versions: + assert ver in result.stdout @pytest.mark.include_capsule