From 3c63b8ff92189d882aa38292b8b6b887fe5b8d46 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Thu, 5 Dec 2024 05:58:45 -0500 Subject: [PATCH] [6.15.z] automation coverage for SAT-28695 (#17082) --- tests/foreman/cli/test_rhcloud_inventory.py | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/foreman/cli/test_rhcloud_inventory.py b/tests/foreman/cli/test_rhcloud_inventory.py index 626f569a094..e9ba42a12f2 100644 --- a/tests/foreman/cli/test_rhcloud_inventory.py +++ b/tests/foreman/cli/test_rhcloud_inventory.py @@ -302,3 +302,37 @@ def test_positive_generate_all_reports_job(target_sat): assert task_output[0].result == "success" finally: target_sat.update_setting('allow_auto_inventory_upload', True) + + +@pytest.mark.rhel_ver_match('N-2') +def test_positive_register_insights_client_host(module_target_sat, rhel_insights_vm): + """Check the below command executed successfully + command - insights-client --ansible-host=foo.example.com + + :id: b578371e-ec36-42de-83fa-bcea6e027fe2 + + :setup: + 1. Enable, sync RHEL BaseOS and AppStream repositories + 2. Create CV, Publish/promote and create AK for host registration + 3. Register host to satellite, Setup Insights is Yes (Override), Install insights-client + + :steps: + 2. Test connection of insights client + 3. execute insight client command given in the description + + :expectedresults: Command executed successfully + + :Verifies: SAT-28695 + + :customerscenario: true + + :CaseAutomation: Automated + + """ + # Test connection of insights client + assert rhel_insights_vm.execute('insights-client --test-connection').status == 0 + + # Execute insight client command + output = rhel_insights_vm.execute(f'insights-client --ansible-host={rhel_insights_vm.hostname}') + assert output.status == 0 + assert 'Ansible hostname updated' in output.stdout