From ff284f48acf712ed6feaddf1ef4a9292a6e634f6 Mon Sep 17 00:00:00 2001 From: yanpliu Date: Wed, 29 May 2024 03:51:54 -0400 Subject: [PATCH] add hypervisor host and guest subscription status and mapping check mapping (#15064) * add hypervisor host and guest subscripition status and mapping check on legacy ui * update virt host mapping check (cherry picked from commit 4b7e29b4e9704365f01109b6d0ff3b0c850d3e10) --- tests/foreman/virtwho/ui/test_esx_sca.py | 16 ++++++++++++++-- tests/foreman/virtwho/ui/test_hyperv_sca.py | 16 ++++++++++++++-- tests/foreman/virtwho/ui/test_kubevirt_sca.py | 16 ++++++++++++++-- tests/foreman/virtwho/ui/test_libvirt_sca.py | 16 ++++++++++++++-- tests/foreman/virtwho/ui/test_nutanix_sca.py | 17 +++++++++++++++-- 5 files changed, 71 insertions(+), 10 deletions(-) diff --git a/tests/foreman/virtwho/ui/test_esx_sca.py b/tests/foreman/virtwho/ui/test_esx_sca.py index 118e7a0cfb0..9bbeb9597cd 100644 --- a/tests/foreman/virtwho/ui/test_esx_sca.py +++ b/tests/foreman/virtwho/ui/test_esx_sca.py @@ -40,7 +40,7 @@ class TestVirtwhoConfigforEsx: @pytest.mark.upgrade @pytest.mark.parametrize('deploy_type_ui', ['id', 'script'], indirect=True) def test_positive_deploy_configure_by_id_script( - self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui + self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui, default_location ): """Verify configure created and deployed with id. @@ -50,12 +50,24 @@ def test_positive_deploy_configure_by_id_script( 1. Config can be created and deployed by command or script 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite - 4. Virtual sku can be generated and attached + 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI 5. Config can be deleted :CaseImportance: High """ + hypervisor_name, guest_name = deploy_type_ui + # Check virt-wh oconfig status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI + org_session.location.select(default_location.name) + hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] + hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) + assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' + assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' + # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI + virtualguest = org_session.contenthost.read_legacy_ui(guest_name) + assert virtualguest['details']['subscription_status'] == 'Simple Content Access' + assert virtualguest['details']['virtual_host'] == hypervisor_display_name @pytest.mark.tier2 def test_positive_debug_option( diff --git a/tests/foreman/virtwho/ui/test_hyperv_sca.py b/tests/foreman/virtwho/ui/test_hyperv_sca.py index 5fcd47bdb88..d0b2062677a 100644 --- a/tests/foreman/virtwho/ui/test_hyperv_sca.py +++ b/tests/foreman/virtwho/ui/test_hyperv_sca.py @@ -25,7 +25,7 @@ class TestVirtwhoConfigforHyperv: @pytest.mark.tier2 @pytest.mark.parametrize('deploy_type_ui', ['id', 'script'], indirect=True) def test_positive_deploy_configure_by_id_script( - self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui + self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui, default_location ): """Verify configure created and deployed with id. @@ -35,12 +35,24 @@ def test_positive_deploy_configure_by_id_script( 1. Config can be created and deployed by command or script 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite - 4. Virtual sku can be generated and attached + 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI 5. Config can be deleted :CaseImportance: High """ + hypervisor_name, guest_name = deploy_type_ui + # Check virt-wh oconfig status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI + org_session.location.select(default_location.name) + hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] + hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) + assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' + assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' + # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI + virtualguest = org_session.contenthost.read_legacy_ui(guest_name) + assert virtualguest['details']['subscription_status'] == 'Simple Content Access' + assert virtualguest['details']['virtual_host'] == hypervisor_display_name @pytest.mark.tier2 def test_positive_hypervisor_id_option( diff --git a/tests/foreman/virtwho/ui/test_kubevirt_sca.py b/tests/foreman/virtwho/ui/test_kubevirt_sca.py index 14714df675d..928243755d5 100644 --- a/tests/foreman/virtwho/ui/test_kubevirt_sca.py +++ b/tests/foreman/virtwho/ui/test_kubevirt_sca.py @@ -25,7 +25,7 @@ class TestVirtwhoConfigforKubevirt: @pytest.mark.tier2 @pytest.mark.parametrize('deploy_type_ui', ['id', 'script'], indirect=True) def test_positive_deploy_configure_by_id_script( - self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui + self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui, default_location ): """Verify configure created and deployed with id. @@ -35,12 +35,24 @@ def test_positive_deploy_configure_by_id_script( 1. Config can be created and deployed by command or script 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite - 4. Virtual sku can be generated and attached + 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI 5. Config can be deleted :CaseImportance: High """ + hypervisor_name, guest_name = deploy_type_ui + # Check virt-wh oconfig status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI + org_session.location.select(default_location.name) + hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] + hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) + assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' + assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' + # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI + virtualguest = org_session.contenthost.read_legacy_ui(guest_name) + assert virtualguest['details']['subscription_status'] == 'Simple Content Access' + assert virtualguest['details']['virtual_host'] == hypervisor_display_name @pytest.mark.tier2 def test_positive_hypervisor_id_option( diff --git a/tests/foreman/virtwho/ui/test_libvirt_sca.py b/tests/foreman/virtwho/ui/test_libvirt_sca.py index 66c73926ab8..e0d4d67db7c 100644 --- a/tests/foreman/virtwho/ui/test_libvirt_sca.py +++ b/tests/foreman/virtwho/ui/test_libvirt_sca.py @@ -25,7 +25,7 @@ class TestVirtwhoConfigforLibvirt: @pytest.mark.tier2 @pytest.mark.parametrize('deploy_type_ui', ['id', 'script'], indirect=True) def test_positive_deploy_configure_by_id_script( - self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui + self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui, default_location ): """Verify configure created and deployed with id. @@ -35,12 +35,24 @@ def test_positive_deploy_configure_by_id_script( 1. Config can be created and deployed by command or script 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite - 4. Virtual sku can be generated and attached + 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI 5. Config can be deleted :CaseImportance: High """ + hypervisor_name, guest_name = deploy_type_ui + # Check virt-wh oconfig status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI + org_session.location.select(default_location.name) + hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] + hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) + assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' + assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' + # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI + virtualguest = org_session.contenthost.read_legacy_ui(guest_name) + assert virtualguest['details']['subscription_status'] == 'Simple Content Access' + assert virtualguest['details']['virtual_host'] == hypervisor_display_name @pytest.mark.tier2 def test_positive_hypervisor_id_option( diff --git a/tests/foreman/virtwho/ui/test_nutanix_sca.py b/tests/foreman/virtwho/ui/test_nutanix_sca.py index b085fc55ec1..8ba8efd3692 100644 --- a/tests/foreman/virtwho/ui/test_nutanix_sca.py +++ b/tests/foreman/virtwho/ui/test_nutanix_sca.py @@ -29,7 +29,7 @@ class TestVirtwhoConfigforNutanix: @pytest.mark.tier2 @pytest.mark.parametrize('deploy_type_ui', ['id', 'script'], indirect=True) def test_positive_deploy_configure_by_id_script( - self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui + self, module_sca_manifest_org, org_session, form_data_ui, deploy_type_ui, default_location ): """Verify configure created and deployed with id. @@ -39,11 +39,24 @@ def test_positive_deploy_configure_by_id_script( 1. Config can be created and deployed by command or script 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite - 4. Config can be deleted + 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI + 5. Config can be deleted :CaseImportance: High """ + hypervisor_name, guest_name = deploy_type_ui + # Check virt-wh oconfig status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI + org_session.location.select(default_location.name) + hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] + hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) + assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' + assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' + # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI + virtualguest = org_session.contenthost.read_legacy_ui(guest_name) + assert virtualguest['details']['subscription_status'] == 'Simple Content Access' + assert virtualguest['details']['virtual_host'] == hypervisor_display_name @pytest.mark.tier2 def test_positive_hypervisor_id_option(