Skip to content

Commit

Permalink
Add timeout to integration tests LXD container removal (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
bschimke95 authored Oct 24, 2024
1 parent 4469973 commit abb6f7f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/integration/tests/test_util/harness/lxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,17 @@ def delete_instance(self, instance_id: str):
raise HarnessError(f"unknown instance {instance_id}")

try:
run(["lxc", "rm", instance_id, "--force"])
# There are cases where the instance is not deleted properly and this command is stuck.
# A timeout prevents this.
# TODO(ben): This is a workaround for an issue that arises because of our use of
# privileged containers. We eventually move away from this (not supported >24.10)
# which should also fix this issue and make this timeout unnecessary.
run(["lxc", "rm", instance_id, "--force"], timeout=60 * 5)
except subprocess.CalledProcessError as e:
raise HarnessError(f"failed to delete instance {instance_id}") from e
except subprocess.TimeoutExpired:
LOG.warning("LXC container removal timed out.")
pass

self.instances.discard(instance_id)

Expand Down

0 comments on commit abb6f7f

Please sign in to comment.