From c707a37975cd50b9337f81259c28c43b556870d5 Mon Sep 17 00:00:00 2001 From: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:20:28 +0200 Subject: [PATCH] Move SAT_NON_GA_VERSIONS constant to robottelo config (#16225) --- .github/workflows/auto_branching.yml | 2 -- conf/robottelo.yaml.template | 4 ++++ robottelo/config/validators.py | 6 ++++++ robottelo/constants/__init__.py | 1 - tests/foreman/maintain/test_advanced.py | 6 +++--- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/auto_branching.yml b/.github/workflows/auto_branching.yml index 6afb0cfa16..1c09932f2a 100644 --- a/.github/workflows/auto_branching.yml +++ b/.github/workflows/auto_branching.yml @@ -120,7 +120,6 @@ jobs: old_url="https://raw.githubusercontent.com/SatelliteQE/robottelo/master/tests/foreman/data/uri.sh" new_url="https://raw.githubusercontent.com/SatelliteQE/robottelo/${{ github.event.inputs.target_branch }}/tests/foreman/data/uri.sh" FILE_PATH="./robottelo/constants/__init__.py" - awk '/SAT_NON_GA_VERSIONS =/ { sub(/\[[^,]*, /, "[", $0) } 1' "$FILE_PATH" > temp && mv temp "$FILE_PATH" sed -i.bak "s|${old_url}|${new_url}|" "$FILE_PATH" rm "$FILE_PATH.bak" @@ -258,7 +257,6 @@ jobs: # update the version sed -i.bak "s/SATELLITE_VERSION = \"$old_stream_version\"/SATELLITE_VERSION = \"$new_stream_version\"/" "$FILE_PATH" sed -i.bak "s/ SATELLITE_VERSION: \"$old_stream_version\"/ SATELLITE_VERSION: \"$new_stream_version\"/" ./conf/robottelo.yaml.template - sed -i.bak "s/SAT_NON_GA_VERSIONS = \[.*\]/SAT_NON_GA_VERSIONS = $non_ga_versions/" "$FILE_PATH" rm "$FILE_PATH.bak" "./conf/robottelo.yaml.template.bak" - name: git status diff --git a/conf/robottelo.yaml.template b/conf/robottelo.yaml.template index 5b3c2688a1..bb67c31a3d 100644 --- a/conf/robottelo.yaml.template +++ b/conf/robottelo.yaml.template @@ -16,6 +16,10 @@ ROBOTTELO: # Satellite version supported by this branch # UNDR version is used for some URL composition SATELLITE_VERSION: "6.17" + # Update non-ga versions with each release + SAT_NON_GA_VERSIONS: + - '6.16' + - '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: diff --git a/robottelo/config/validators.py b/robottelo/config/validators.py index 07b2781dc3..3c8726be3e 100644 --- a/robottelo/config/validators.py +++ b/robottelo/config/validators.py @@ -317,6 +317,12 @@ robottelo=[ Validator('robottelo.settings.ignore_validation_errors', is_type_of=bool, default=False), Validator('robottelo.rhel_source', default='ga', is_in=['ga', 'internal']), + Validator( + 'robottelo.sat_non_ga_versions', + is_type_of=list, + default=[], + cast=lambda x: list(map(str, x)), + ), ], shared_function=[ Validator('shared_function.storage', is_in=('file', 'redis'), default='file'), diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 1cd51d529c..c888241b40 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -8,7 +8,6 @@ # This should be updated after each version branch SATELLITE_VERSION = "6.17" SATELLITE_OS_VERSION = "8" -SAT_NON_GA_VERSIONS = ['6.16', '6.17'] # Default system ports HTTPS_PORT = '443' diff --git a/tests/foreman/maintain/test_advanced.py b/tests/foreman/maintain/test_advanced.py index 219a22d03d..d893c8abf5 100644 --- a/tests/foreman/maintain/test_advanced.py +++ b/tests/foreman/maintain/test_advanced.py @@ -16,7 +16,7 @@ import yaml from robottelo.config import robottelo_tmp_dir, settings -from robottelo.constants import MAINTAIN_HAMMER_YML, SAT_NON_GA_VERSIONS +from robottelo.constants import MAINTAIN_HAMMER_YML from robottelo.hosts import get_sat_rhel_version, get_sat_version sat_x_y_release = f'{get_sat_version().major}.{get_sat_version().minor}' @@ -298,7 +298,7 @@ def test_positive_satellite_repositories_setup(sat_maintain): """ sat_version = ".".join(sat_maintain.version.split('.')[0:2]) result = sat_maintain.cli.Advanced.run_repositories_setup(options={'version': sat_version}) - if sat_version not in SAT_NON_GA_VERSIONS: + if sat_version not in settings.robottelo.sat_non_ga_versions: assert result.status == 0 assert 'FAIL' not in result.stdout result = sat_maintain.execute('yum repolist') @@ -331,7 +331,7 @@ def test_positive_capsule_repositories_setup(sat_maintain): """ sat_version = ".".join(sat_maintain.version.split('.')[0:2]) result = sat_maintain.cli.Advanced.run_repositories_setup(options={'version': sat_version}) - if sat_version not in SAT_NON_GA_VERSIONS: + if sat_version not in settings.robottelo.sat_non_ga_versions: assert result.status == 0 assert 'FAIL' not in result.stdout result = sat_maintain.execute('yum repolist')