From bac77e7c92a6e6c2be217590c9a225acae055a32 Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Wed, 10 Apr 2024 05:37:27 -0400 Subject: [PATCH] [6.15.z] Fix teardown of bootdisk tests with request.addfinalizer (#14710) --- tests/foreman/cli/test_bootdisk.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/foreman/cli/test_bootdisk.py b/tests/foreman/cli/test_bootdisk.py index 4775c3bbdea..5e0ca29eec6 100644 --- a/tests/foreman/cli/test_bootdisk.py +++ b/tests/foreman/cli/test_bootdisk.py @@ -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, @@ -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()