From 94a036be3a785d411aaeb0936ef690e252d46b23 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 17 Mar 2026 14:41:41 +0100 Subject: [PATCH] test/infamy: retry copy() on ConnectionError in restconf transport A service restart triggered by finit during sysrepo callbacks can drop an in-flight HTTP connection, causing copy("candidate", "running") to fail with RemoteDisconnected. Add retry logic consistent with the existing PATCH retry pattern in put_config_dict(). Signed-off-by: Joachim Wiberg --- test/infamy/restconf.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/infamy/restconf.py b/test/infamy/restconf.py index 1dc4453d..b59f6407 100644 --- a/test/infamy/restconf.py +++ b/test/infamy/restconf.py @@ -489,10 +489,20 @@ class Device(Transport): return data - def copy(self, source, target): + def copy(self, source, target, retries=3): factory = self.get_datastore(source) data = factory.print_mem("json", with_siblings=True, pretty=False) - self.put_datastore(target, json.loads(data)) + last_error = None + for attempt in range(0, retries): + try: + self.put_datastore(target, json.loads(data)) + return + except requests.exceptions.ConnectionError as e: + last_error = e + if attempt < retries - 1: + print(f"Failed copy {source}->{target}: {e} Retrying ...") + time.sleep(1) + raise last_error def reboot(self): self.call_rpc("ietf-system:system-restart")