From 42d880fe836b82534e26e22b11b885c59168ce16 Mon Sep 17 00:00:00 2001 From: amolpati30 <151733635+amolpati30@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:11:49 +0530 Subject: [PATCH] verify host owner name after host registration (#15178) * verify host name after host registration * assertion added for host (cherry picked from commit 423864f72c811278e59bc2160247018ec2e4b4be) --- tests/foreman/cli/test_registration.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/foreman/cli/test_registration.py b/tests/foreman/cli/test_registration.py index 22d24ae517e..8e7927a3306 100644 --- a/tests/foreman/cli/test_registration.py +++ b/tests/foreman/cli/test_registration.py @@ -42,10 +42,11 @@ def test_host_registration_end_to_end( :steps: 1. Register host with global registration template to Satellite and Capsule + 2. Check the host is registered and verify host owner name - :expectedresults: Host registered successfully + :expectedresults: Host registered successfully with valid owner name - :BZ: 2156926 + :BZ: 2156926, 2252768 :customerscenario: true """ @@ -57,6 +58,14 @@ def test_host_registration_end_to_end( rc = 1 if rhel_contenthost.os_version.major == 6 else 0 assert result.status == rc, f'Failed to register host: {result.stderr}' + owner_name = module_target_sat.cli.Host.info( + options={'name': rhel_contenthost.hostname, 'fields': 'Additional info/owner'} + ) + # Verify host owner name set correctly + assert 'Admin User' in owner_name['additional-info']['owner']['name'], ( + f'Host owner name is incorrect: ' f'{owner_name["additional-info"]["owner"]["name"]}' + ) + # Verify server.hostname and server.port from subscription-manager config assert module_target_sat.hostname == rhel_contenthost.subscription_config['server']['hostname'] assert rhel_contenthost.subscription_config['server']['port'] == CLIENT_PORT @@ -79,6 +88,14 @@ def test_host_registration_end_to_end( rc = 1 if rhel_contenthost.os_version.major == 6 else 0 assert result.status == rc, f'Failed to register host: {result.stderr}' + owner_name = module_target_sat.cli.Host.info( + options={'name': rhel_contenthost.hostname, 'fields': 'Additional info/owner'} + ) + # Verify capsule host owner name set correctly + assert 'Admin User' in owner_name['additional-info']['owner']['name'], ( + f'Host owner name is incorrect: ' f'{owner_name["additional-info"]["owner"]["name"]}' + ) + # Verify server.hostname and server.port from subscription-manager config assert ( module_capsule_configured.hostname