Skip to content

Commit

Permalink
remove test instances even when failing to remove the snap
Browse files Browse the repository at this point in the history
The tests may fail to remove the snap for various reasons. In order
to avoid leaking harness instances that could potentially
exhaust the host resources, we'll clean the harness instances even if
we were unable to remove the snap.
  • Loading branch information
petrutlucian94 committed Nov 12, 2024
1 parent 6935ec8 commit a9b2cc3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/integration/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,10 @@ def instances(
LOG.debug("Generating inspection reports for test instances")
_generate_inspection_report(h, instance.id)

util.remove_k8s_snap(instance)

h.delete_instance(instance.id)
try:
util.remove_k8s_snap(instance)
finally:
h.delete_instance(instance.id)


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

0 comments on commit a9b2cc3

Please sign in to comment.