From fa8f2403b646d815c2427600f403116e8b9a1362 Mon Sep 17 00:00:00 2001 From: sshmulev Date: Tue, 6 Aug 2024 09:31:29 +0300 Subject: [PATCH] CIV: Refactor test_yum_group_install https://issues.redhat.com/browse/CLOUDX-837 --- test_suite/cloud/test_aws.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/test_suite/cloud/test_aws.py b/test_suite/cloud/test_aws.py index 7487eab5..bda35d6d 100644 --- a/test_suite/cloud/test_aws.py +++ b/test_suite/cloud/test_aws.py @@ -558,12 +558,25 @@ def test_yum_group_install(self, host): pytest.skip('Not applicable to Atomic host AMIs') with host.sudo(): - assert host.run_test('yum -y groupinstall "Development tools"'), \ - 'Error while installing Development tools group' - - package_to_check = 'glibc-devel' - assert host.package(package_to_check).is_installed, \ - f'{package_to_check} is not installed' + attempts = 2 + for attempt in range(attempts): + try: + assert host.run_test('yum -y groupinstall "Development tools"'), \ + 'Error while installing Development tools group' + break + except AssertionError as e: + err_message = "This system is not registered to Red Hat Subscription Management" + if err_message in str(e) and attempt == 0: + host.run( + 'echo -e "enabled=0" > /etc/yum/pluginconf.d/subscription-manager.conf' + ' && yum clean all' + ) + elif attempt == 1: + raise AssertionError('Error while installing Development tools group after retrying') + + package_to_check = 'glibc-devel' + assert host.package(package_to_check).is_installed, \ + f'{package_to_check} is not installed' @pytest.mark.pub @pytest.mark.run_on(['rhel'])