From ef85aba599c72a8a0d039a4c7114312fdeec75e4 Mon Sep 17 00:00:00 2001 From: vsedmik <46570670+vsedmik@users.noreply.github.com> Date: Mon, 6 Jan 2025 22:03:52 +0100 Subject: [PATCH] Fix legacy errata upgrade scenario tests (#17183) Fix errata upgrade scenario tests (cherry picked from commit caff4dd5b45db3bf6a135184053253634eebbd60) --- robottelo/host_helpers/satellite_mixins.py | 5 ++++- tests/upgrades/test_errata.py | 4 +++- tests/upgrades/test_repository.py | 4 +++- tests/upgrades/test_subscription.py | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/robottelo/host_helpers/satellite_mixins.py b/robottelo/host_helpers/satellite_mixins.py index 34eb1787cb2..7b00ef4fb5a 100644 --- a/robottelo/host_helpers/satellite_mixins.py +++ b/robottelo/host_helpers/satellite_mixins.py @@ -5,6 +5,7 @@ import random import re +from fauxfactory import gen_string import requests from wait_for import TimedOutError, wait_for @@ -201,15 +202,17 @@ def is_sca_mode_enabled(self, org_id): """ return self.api.Organization(id=org_id).read().simple_content_access - def publish_content_view(self, org, repo_list, name): + def publish_content_view(self, org, repo_list, name=None): """This method publishes the content view for a given organization and repository list. :param str org: The name of the organization to which the content view belongs :param list or str repo_list: A list of repositories or a single repository + :param str name: Name of the Content View to create. Defaults to random string. :return: A dictionary containing the details of the published content view. """ repo = repo_list if isinstance(repo_list, list) else [repo_list] + name = name or gen_string('alpha') content_view = self.api.ContentView(organization=org, repository=repo, name=name).create() content_view.publish() return content_view.read() diff --git a/tests/upgrades/test_errata.py b/tests/upgrades/test_errata.py index 8fc87c4d8af..4418fe54464 100644 --- a/tests/upgrades/test_errata.py +++ b/tests/upgrades/test_errata.py @@ -195,7 +195,9 @@ def test_pre_scenario_generate_errata_for_client( } ) - @pytest.mark.parametrize('pre_upgrade_data', ['rhel7', 'rhel8', 'rhel9'], indirect=True) + @pytest.mark.parametrize( + 'pre_upgrade_data', ['rhel7-ipv4', 'rhel8-ipv4', 'rhel9-ipv4'], indirect=True + ) @pytest.mark.post_upgrade(depend_on=test_pre_scenario_generate_errata_for_client) def test_post_scenario_errata_count_installation(self, target_sat, pre_upgrade_data): """Post-upgrade scenario that applies errata on the RHEL client that was set up diff --git a/tests/upgrades/test_repository.py b/tests/upgrades/test_repository.py index 0a256363d59..e6e87332250 100644 --- a/tests/upgrades/test_repository.py +++ b/tests/upgrades/test_repository.py @@ -482,7 +482,9 @@ def test_pre_simple_content_access_only( } ) - @pytest.mark.parametrize('pre_upgrade_data', ['rhel7', 'rhel8', 'rhel9'], indirect=True) + @pytest.mark.parametrize( + 'pre_upgrade_data', ['rhel7-ipv4', 'rhel8-ipv4', 'rhel9-ipv4'], indirect=True + ) @pytest.mark.post_upgrade(depend_on=test_pre_simple_content_access_only) def test_post_simple_content_access_only(self, target_sat, pre_upgrade_data): """Check that both the custom repository and the red hat repository are enabled diff --git a/tests/upgrades/test_subscription.py b/tests/upgrades/test_subscription.py index 9817b1f85d3..203daa6fd96 100644 --- a/tests/upgrades/test_subscription.py +++ b/tests/upgrades/test_subscription.py @@ -141,7 +141,9 @@ def test_pre_subscription_scenario_auto_attach( } ) - @pytest.mark.parametrize('pre_upgrade_data', ['rhel7', 'rhel8', 'rhel9'], indirect=True) + @pytest.mark.parametrize( + 'pre_upgrade_data', ['rhel7-ipv4', 'rhel8-ipv4', 'rhel9-ipv4'], indirect=True + ) @pytest.mark.post_upgrade(depend_on=test_pre_subscription_scenario_auto_attach) @pytest.mark.manifester def test_post_subscription_scenario_auto_attach(self, request, target_sat, pre_upgrade_data):