Skip to content

Commit

Permalink
virt-who config upgrade duplicate config issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yanpliu committed Mar 13, 2024
1 parent 73b7bd2 commit 67639e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/upgrades/test_virtwho.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")}',
}


Expand Down Expand Up @@ -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,
}
)

Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 67639e5

Please sign in to comment.