From 4ce6900b1a9ca1c5ba94a1e795cb3e3e4ee70dab Mon Sep 17 00:00:00 2001 From: Guillaume Lambert Date: Thu, 24 Jun 2021 15:50:15 +0200 Subject: [PATCH] Allow tox func tests suite to run in parallel - append PID to lighty controller log file This avoids parsing the file of another controller instance. - increase various timeout limits - rework tox "depends" parameters used to artificially create a sequel in parallel mode. tox -p auto strategy is only based on CPU core numbers and not memory nor any other parameter. This is not optimal since it can cause other resources starvation issues in the gate (but not locally). The new configuration proposed here chains in parallel: * PCE tests first then 1.2.1 device tests * 7.1 device tests first then 2.2.1 device tests This way, only 2 controller instances can be run simultaneously, what prevents resources from starvation in the gate. JIRA: TRNSPRTPCE-482 Signed-off-by: Guillaume Lambert Change-Id: I3a0a66a45a8e170b4554c9de769e1e65b96d224f --- tests/transportpce_tests/common/test_utils.py | 12 ++++++------ tox.ini | 9 ++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/transportpce_tests/common/test_utils.py b/tests/transportpce_tests/common/test_utils.py index 0b5ed5244..2b4c7f28c 100644 --- a/tests/transportpce_tests/common/test_utils.py +++ b/tests/transportpce_tests/common/test_utils.py @@ -71,7 +71,7 @@ else: RESTCONF_BASE_URL = "http://localhost:8181/restconf" if "USE_LIGHTY" in os.environ and os.environ['USE_LIGHTY'] == 'True': - TPCE_LOG = 'odl.log' + TPCE_LOG = 'odl-' + str(os.getpid()) + '.log' else: TPCE_LOG = KARAF_LOG @@ -101,7 +101,7 @@ def start_tpce(): else: process = start_karaf() start_msg = KARAF_OK_START_MSG - if wait_until_log_contains(TPCE_LOG, start_msg, time_to_wait=120): + if wait_until_log_contains(TPCE_LOG, start_msg, time_to_wait=300): print("OpenDaylight started !") else: print("OpenDaylight failed to start !") @@ -129,7 +129,7 @@ def start_lighty(): os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "lighty", "target", "tpce", "clean-start-controller.sh") - with open('odl.log', 'w') as outfile: + with open(TPCE_LOG, 'w') as outfile: return subprocess.Popen( ["sh", executable], stdout=outfile, stderr=outfile, stdin=None) @@ -232,7 +232,7 @@ def mount_device(node_id, sim): "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} response = put_request(url, body) - if wait_until_log_contains(TPCE_LOG, re.escape("Triggering notification stream NETCONF for node " + node_id), 60): + if wait_until_log_contains(TPCE_LOG, re.escape("Triggering notification stream NETCONF for node " + node_id), 180): print("Node " + node_id + " correctly added to tpce topology", end='... ', flush=True) else: print("Node " + node_id + " still not added to tpce topology", end='... ', flush=True) @@ -245,7 +245,7 @@ def mount_device(node_id, sim): def unmount_device(node_id): url = URL_CONFIG_NETCONF_TOPO + "node/" + node_id response = delete_request(url) - if wait_until_log_contains(TPCE_LOG, re.escape("onDeviceDisConnected: " + node_id), 60): + if wait_until_log_contains(TPCE_LOG, re.escape("onDeviceDisConnected: " + node_id), 180): print("Node " + node_id + " correctly deleted from tpce topology", end='... ', flush=True) else: print("Node " + node_id + " still not deleted from tpce topology", end='... ', flush=True) @@ -449,7 +449,7 @@ def start_honeynode(log_file: str, sim): return None -def wait_until_log_contains(log_file, regexp, time_to_wait=20): +def wait_until_log_contains(log_file, regexp, time_to_wait=60): # pylint: disable=lost-exception stringfound = False filefound = False diff --git a/tox.ini b/tox.ini index 3b3ec4c2b..eb85bbe97 100644 --- a/tox.ini +++ b/tox.ini @@ -73,7 +73,7 @@ commands = [testenv:tests121] depends = buildcontroller,sims121,testsPCE -#the last dependency is to avoid temporarily concurrent ressources problem to fix in parallel mode +# testsPCE dependency is only here to chain tests in the gate and avoid resources starvation whitelist_externals = launch_tests.sh passenv = LAUNCHER setenv = @@ -94,8 +94,8 @@ commands = # files attributes. [testenv:tests221] -depends = buildcontroller,sims221,tests121 -#the last dependency is to avoid temporarily concurrent ressources problem to fix in parallel mode +depends = buildcontroller,sims221,tests71 +# tests71 dependency is only here to chain tests in the gate and avoid ressources starvation whitelist_externals = launch_tests.sh passenv = LAUNCHER setenv = @@ -108,8 +108,7 @@ commands = ./launch_tests.sh 2.2.1 {posargs:} [testenv:tests71] -depends = buildcontroller,sims71,tests221 -#the last dependency is to avoid temporarily concurrent ressources problem to fix in parallel mode +depends = buildcontroller,sims71 whitelist_externals = launch_tests.sh passenv = LAUNCHER setenv = -- 2.36.6