Skip to content

Commit

Permalink
CIV: Refactor test_yum_group_install
Browse files Browse the repository at this point in the history
  • Loading branch information
sshmulev committed Aug 6, 2024
1 parent ff2bcfd commit fa8f240
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions test_suite/cloud/test_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit fa8f240

Please sign in to comment.