Skip to content

Commit

Permalink
Making sure cnv deployment clean up occurs even when deployment fails…
Browse files Browse the repository at this point in the history
… in between

Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
Mahesh Shetty authored and Mahesh Shetty committed Dec 12, 2024
1 parent 6b62d57 commit eefe887
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8585,21 +8585,24 @@ def setup_cnv(request):
"""
cnv_obj = CNVInstaller()
installed = False
if not cnv_obj.post_install_verification():
installed = True
cnv_obj.deploy_cnv()
try:
if not cnv_obj.post_install_verification():
installed = True
cnv_obj.deploy_cnv()

def finalizer():
"""
Clean up CNV deployment
finally:

"""
def finalizer():
"""
Clean up CNV deployment
# Uninstall CNV only if installed by this fixture
if installed:
cnv_obj.uninstall_cnv()
"""

request.addfinalizer(finalizer)
# Uninstall CNV only if installed by this fixture
if installed:
cnv_obj.uninstall_cnv()

request.addfinalizer(finalizer)


@pytest.fixture(scope="class")
Expand Down

0 comments on commit eefe887

Please sign in to comment.