From e450e3fea232b5c25e99edb54abd530729e075ed Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Wed, 23 Oct 2024 10:21:24 +0200 Subject: [PATCH] add timeout --- tests/integration/tests/test_util/harness/lxd.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/tests/test_util/harness/lxd.py b/tests/integration/tests/test_util/harness/lxd.py index 685aa23ac..450ffa978 100644 --- a/tests/integration/tests/test_util/harness/lxd.py +++ b/tests/integration/tests/test_util/harness/lxd.py @@ -228,9 +228,14 @@ def delete_instance(self, instance_id: str): raise HarnessError(f"unknown instance {instance_id}") try: - run(["lxc", "rm", instance_id, "--force", "--debug"]) + # There are cases where the instance is not deleted properly and this command is stuck. + # A timeout prevents this. + run(["lxc", "rm", instance_id, "--force", "--debug"], timeout=60*5) except subprocess.CalledProcessError as e: raise HarnessError(f"failed to delete instance {instance_id}") from e + except subprocess.TimeoutExpired as e: + LOG.warning("LXC container removal timed out.") + pass self.instances.discard(instance_id)