Skip to content

Commit

Permalink
Fix teardown of bootdisk tests with request.addfinalizer (#14701)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Talreja <[email protected]>
(cherry picked from commit a13c05d)
  • Loading branch information
Gauravtalreja1 authored and web-flow committed Apr 10, 2024
1 parent 35dabac commit a5dd20a
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.parametrize('module_sync_kickstart_content', [7, 8, 9], indirect=True)
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 a5dd20a

Please sign in to comment.