From 94d97dd234e47d4393401b208b6191b640e7f69e Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 7 Jan 2025 11:43:25 +0100 Subject: [PATCH] Retry seed loading in case snap is not ready yet (#925) --- tests/integration/tests/test_util/harness/lxd.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/integration/tests/test_util/harness/lxd.py b/tests/integration/tests/test_util/harness/lxd.py index 7b767af05..43bcef980 100644 --- a/tests/integration/tests/test_util/harness/lxd.py +++ b/tests/integration/tests/test_util/harness/lxd.py @@ -131,8 +131,11 @@ def new_instance(self, network_type: str = "IPv4") -> Instance: except subprocess.CalledProcessError as e: raise HarnessError(f"Failed to create LXD container {instance_id}") from e - self.exec(instance_id, ["snap", "wait", "system", "seed.loaded"]) - return Instance(self, instance_id) + instance = Instance(self, instance_id) + stubbornly(retries=3, delay_s=5).on(instance).exec( + ["snap", "wait", "system", "seed.loaded"] + ) + return instance def _configure_profile(self, profile_name: str, profile_config: str): LOG.debug("Checking for LXD profile %s", profile_name)