Allow tox func tests suite to run in parallel 27/98227/2
authorGuillaume Lambert <guillaume.lambert@orange.com>
Thu, 24 Jun 2021 13:50:15 +0000 (15:50 +0200)
committerVachhani, Shweta (sv111y) <sv111y@att.com>
Sun, 31 Oct 2021 11:23:06 +0000 (07:23 -0400)
- 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 0b5ed5244f2676964dea65ea3701b5975f551033..2b4c7f28cdceb3d82baec9259656b019bb518786 100644 (file)
@@ -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 3b3ec4c2b985c6a0c7fd145c3107fabd9489e247..eb85bbe9799f2fc8500beb3bfa03afad3749474c 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 =