From 67639e54c2b1341a0a69dc41145551bb1a1e3c11 Mon Sep 17 00:00:00 2001 From: yanpliu Date: Wed, 13 Mar 2024 02:57:55 -0400 Subject: [PATCH] virt-who config upgrade duplicate config issue fix --- tests/upgrades/test_virtwho.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/upgrades/test_virtwho.py b/tests/upgrades/test_virtwho.py index 3691e3a8d70..95b36ec5749 100644 --- a/tests/upgrades/test_virtwho.py +++ b/tests/upgrades/test_virtwho.py @@ -37,7 +37,7 @@ def form_data(target_sat): 'satellite_url': target_sat.hostname, 'hypervisor_username': esx.hypervisor_username, 'hypervisor_password': esx.hypervisor_password, - 'name': 'preupgrade_virt_who', + 'name': f'preupgrade_virt_who_{gen_string("alpha")}', } @@ -120,6 +120,7 @@ def test_pre_create_virt_who_configuration( 'org_id': org.id, 'org_name': org.name, 'org_label': org.label, + 'name': vhd.name, } ) @@ -146,15 +147,16 @@ def test_post_crud_virt_who_configuration(self, form_data, pre_upgrade_data, tar org_id = pre_upgrade_data.get('org_id') org_name = pre_upgrade_data.get('org_name') org_label = pre_upgrade_data.get('org_label') + name = pre_upgrade_data.get('name') # Post upgrade, Verify virt-who exists and has same status. vhd = target_sat.api.VirtWhoConfig(organization_id=org_id).search( - query={'search': f'name={form_data["name"]}'} + query={'search': f'name={name}'} )[0] if not is_open('BZ:1802395'): assert vhd.status == 'ok' # Verify virt-who status via CLI as we cannot check it via API now - vhd_cli = target_sat.cli.VirtWhoConfig.exists(search=('name', form_data['name'])) + vhd_cli = target_sat.cli.VirtWhoConfig.exists(search=('name', name)) assert ( target_sat.cli.VirtWhoConfig.info({'id': vhd_cli['id']})['general-information'][ 'status' @@ -185,7 +187,7 @@ def test_post_crud_virt_who_configuration(self, form_data, pre_upgrade_data, tar ) virt_who_instance = ( target_sat.api.VirtWhoConfig(organization_id=org_id) - .search(query={'search': f'name={form_data["name"]}'})[0] + .search(query={'search': f'name={name}'})[0] .status ) assert virt_who_instance == 'ok'