Skip to content

Commit

Permalink
Fix teardown of bootdisk tests with request.addfinalizer
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Talreja <[email protected]>
  • Loading branch information
Gauravtalreja1 committed Apr 9, 2024
1 parent 21580fc commit 8bf71d0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/foreman/cli/test_bootdisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

@pytest.mark.rhel_ver_match('[^6]')
def test_positive_bootdisk_download_https(
request,
module_location,
module_sync_kickstart_content,
module_provisioning_capsule,
Expand Down Expand Up @@ -79,8 +80,12 @@ def test_positive_bootdisk_download_https(
'lifecycle-environment-id': module_lce_library.id,
}
)

@request.addfinalizer
def _finalize():
module_target_sat.api.Host(id=host.id).delete()
module_target_sat.api.Media(id=media['id']).delete()

# Check if full-host bootdisk can be downloaded.
bootdisk = module_target_sat.cli.Bootdisk.host({'host-id': host['id'], 'full': 'true'})
assert 'Successfully downloaded host disk image' in bootdisk['message']
module_target_sat.api.Host(id=host.id).delete()
module_target_sat.api.Media(id=media['id']).delete()

0 comments on commit 8bf71d0

Please sign in to comment.