Skip to content

Commit 47f0917

Browse files
committed
test: fix NETCONF backend to propagate RPC errors
The put_config() retry loop was catching and printing RpcError exceptions but never re-raising them after exhausting retries. This caused tests to silently continue despite configuration failures, masking validation errors. Now properly propagates errors after all retries are exhausted, matching the error handling behavior of the RESTCONF backend. Fixes #1250 Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 00f2061 commit 47f0917

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/infamy/netconf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,21 @@ def put_config(self, edit):
297297
xml = xml.replace(f"yang:operation=\"{src}\"",
298298
f"nc:operation=\"{dst}\"" if dst else "")
299299

300+
last_error = None
300301
for _ in range(0, 3):
301302
try:
302303
self.ncc.edit_config(xml, default_operation='merge')
304+
last_error = None
305+
break
303306
except RpcError as _e:
307+
last_error = _e
304308
print(f"Failed sending edit-config RPC: {_e} Retrying ...")
305309
time.sleep(1)
306310
continue
307-
break
311+
312+
# If we exhausted all retries, raise the last error
313+
if last_error is not None:
314+
raise last_error
308315

309316
def put_config_dicts(self, models):
310317
"""PUT full configuration of all models to running-config"""

0 commit comments

Comments
 (0)