Allow tox func tests suite to run in parallel 64/96664/20
authorGuillaume Lambert <guillaume.lambert@orange.com>
Thu, 24 Jun 2021 13:50:15 +0000 (15:50 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Tue, 17 Aug 2021 23:05:44 +0000 (01:05 +0200)
- 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 <guillaume.lambert@orange.com>
Change-Id: I3a0a66a45a8e170b4554c9de769e1e65b96d224f

tests/transportpce_tests/common/test_utils.py
tox.ini

index 65bd2bba804641036efcdfcea02652c1bfbb0b7f..3bcd83d18afe3cfeea5faaeeed125c6eb7284184 100644 (file)
@@ -72,7 +72,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
 
@@ -102,7 +102,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 !")
@@ -130,7 +130,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)
 
@@ -233,7 +233,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)
@@ -246,7 +246,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)
@@ -454,7 +454,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 be29d12ceec8ed3b651fd200a103e2f9f5cef6d2..68ba818c32917acf1e3dd23437fc8579b1bf801c 100644 (file)
--- 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 =
@@ -123,7 +122,7 @@ commands =
 
 [testenv:tests_hybrid]
 depends = buildcontroller,sims121,sims221,sims71,tests121,tests221,tests71
-#the last dependency is to avoid temporarily concurrent ressources problem to fix in parallel mode
+#the last dependency is to avoid temporarily concurrent ressources problem in parallel mode
 whitelist_externals = launch_tests.sh
 passenv = LAUNCHER
 setenv =