From 587f92cbaa9dd1a44edbfb57264a6e8f94ace614 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 18 Jun 2023 17:02:41 +0200 Subject: [PATCH] test/infamy: attempt to handle RpcError "processing timed out" While running tests in GitHub action, the following[1] often happens. From the timestamp it seems unlikely to be casused by timeout, which from what I can tell is 120 sec in the library and 30 sec on our socket. This never happens when running locally, so I've added a simple try-catch to retry the operation, because some[2] jobs actually pass. 2023-06-18 09:18:17 # Traceback (most recent call last): 2023-06-18 09:18:17 # File "/home/runner/work/infix/infix/test/case/infix_interfaces/dual_bridge.py", line 18, in 2023-06-18 09:18:17 # target.put_config_dict("ietf-interfaces", { 2023-06-18 09:18:17 # File "/home/runner/work/infix/infix/test/infamy/netconf.py", line 117, in put_config_dict 2023-06-18 09:18:17 # return self.put_config(lyd.print_mem("xml", with_siblings=True, pretty=False)) 2023-06-18 09:18:17 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2023-06-18 09:18:17 # File "/home/runner/work/infix/infix/test/infamy/netconf.py", line 112, in put_config 2023-06-18 09:18:17 # self.ncc.edit_config(xml, default_operation='merge') 2023-06-18 09:18:17 # File "/root/.infix-test-venv/lib/python3.11/site-packages/netconf_client/ncclient.py", line 277, in edit_config 2023-06-18 09:18:17 # self._send_rpc(rpc_xml) 2023-06-18 09:18:17 # File "/root/.infix-test-venv/lib/python3.11/site-packages/netconf_client/ncclient.py", line 223, in _send_rpc 2023-06-18 09:18:17 # r = f.result(timeout=timeout) 2023-06-18 09:18:17 # ^^^^^^^^^^^^^^^^^^^^^^^^^ 2023-06-18 09:18:17 # File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result 2023-06-18 09:18:17 # return self.__get_result() 2023-06-18 09:18:17 # ^^^^^^^^^^^^^^^^^^^ 2023-06-18 09:18:17 # File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result 2023-06-18 09:18:17 # raise self._exception 2023-06-18 09:18:17 # netconf_client.error.RpcError: EV ORIGIN: "rpc" ID 5 processing timed out. 2023-06-18 09:18:17 # [1]: https://github.com/kernelkit/infix/actions/runs/5302735753/jobs/9597878647 [2]. https://github.com/kernelkit/infix/actions/runs/5302735946/jobs/9597878838 Signed-off-by: Joachim Wiberg --- test/infamy/netconf.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/infamy/netconf.py b/test/infamy/netconf.py index 277ab2fc..8fee3ee4 100644 --- a/test/infamy/netconf.py +++ b/test/infamy/netconf.py @@ -3,6 +3,7 @@ from collections import namedtuple from dataclasses import dataclass import socket +import time import libyang import lxml @@ -109,7 +110,13 @@ class Device(object): def put_config(self, edit): xml = "" + edit + "" - self.ncc.edit_config(xml, default_operation='merge') + for _ in range(0,3): + try: + self.ncc.edit_config(xml, default_operation='merge') + except self.ncc.RpcError: + time.sleep(1) + continue + break def put_config_dict(self, modname, edit): mod = self.ly.get_module(modname)