From 741f9380d688c59f4bcb025a32eba5116bc8318d Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Wed, 21 Aug 2024 06:47:56 -0400 Subject: [PATCH] [6.14.z] Fix failing registration tests (#15788) --- tests/foreman/api/test_registration.py | 5 +++-- tests/foreman/ui/test_registration.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/foreman/api/test_registration.py b/tests/foreman/api/test_registration.py index d1c307d111d..7825497cf93 100644 --- a/tests/foreman/api/test_registration.py +++ b/tests/foreman/api/test_registration.py @@ -119,10 +119,11 @@ def test_positive_allow_reregistration_when_dmi_uuid_changed( location=module_location, ) assert result.status == 0, f'Failed to register host: {result.stderr}' - + target_sat.execute(f'echo \'{{"dmi.system.uuid": "{uuid_2}"}}\' > /etc/rhsm/facts/uuid.facts') + result = rhel_contenthost.execute('subscription-manager unregister') + assert result.status == 0 result = rhel_contenthost.execute('subscription-manager clean') assert result.status == 0 - target_sat.execute(f'echo \'{{"dmi.system.uuid": "{uuid_2}"}}\' > /etc/rhsm/facts/uuid.facts') result = rhel_contenthost.api_register( target_sat, organization=org, diff --git a/tests/foreman/ui/test_registration.py b/tests/foreman/ui/test_registration.py index 6cdb3ef89ea..8c1016dd1be 100644 --- a/tests/foreman/ui/test_registration.py +++ b/tests/foreman/ui/test_registration.py @@ -172,7 +172,9 @@ def test_positive_global_registration_end_to_end( # rex interface iface = 'eth0' # fill in the global registration form - with session: + with target_sat.ui_session() as session: + session.organization.select(org_name=module_org.name) + session.location.select(loc_name=smart_proxy_location.name) cmd = session.host.get_register_command( { 'general.operating_system': default_os.title, @@ -219,7 +221,7 @@ def test_positive_global_registration_end_to_end( # Assert that a yum update was made this day ("Update" or "I, U" in history) timezone_offset = rhel_contenthost.execute('date +"%:z"').stdout.strip() tzinfo = datetime.strptime(timezone_offset, '%z').tzinfo - result = rhel_contenthost.execute('yum history | grep U') + result = rhel_contenthost.execute('yum history | grep -E "I|U"') assert result.status == 0 assert datetime.now(tzinfo).strftime('%Y-%m-%d') in result.stdout # Set "Connect to host using IP address"