summaryrefslogtreecommitdiffstats
path: root/dovetail/run.py
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2016-12-01 22:29:26 -0500
committerMatthewLi <matthew.lijun@huawei.com>2016-12-02 02:44:57 -0500
commit569da572c84c1c291bd6143218f92daf36c59160 (patch)
tree9767845247e463260e6213bdfb0164ad83233bf0 /dovetail/run.py
parent41835d3fdeb7249198b4352fafc30515f9e0ec55 (diff)
[WIP] dovetail report improvement
JIRA: DOVETAIL-49 1)details please refer to https://wiki.opnfv.org/display/dovetail/Dovetail+Reports 2)results please refer to one example https://etherpad.opnfv.org/p/dovetail_report Change-Id: I63a1ba3b6aa1ffe5fa043a11cd3777dd0e8d52d9 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'dovetail/run.py')
-rwxr-xr-xdovetail/run.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/dovetail/run.py b/dovetail/run.py
index b9194c39..d24919b6 100755
--- a/dovetail/run.py
+++ b/dovetail/run.py
@@ -11,6 +11,7 @@
import click
import sys
import os
+import time
import utils.dovetail_logger as dt_logger
import utils.dovetail_utils as dt_utils
@@ -48,6 +49,7 @@ def run_test(testsuite, testarea, logger):
if value is not None and (testarea == 'full' or testarea in value):
testarea_list.append(value)
+ duration = 0
for testcase_name in testarea_list:
logger.info('>>[testcase]: %s' % (testcase_name))
testcase = Testcase.get(testcase_name)
@@ -78,8 +80,11 @@ def run_test(testsuite, testarea, logger):
if not testcase.prepare_cmd():
logger.error('failed to prepare testcase:%s' % testcase.name())
else:
+ start_time = time.time()
for cmd in testcase.cmds:
Container.exec_cmd(container_id, cmd)
+ end_time = time.time()
+ duration = end_time - start_time
# testcase.post_condition()
@@ -88,6 +93,8 @@ def run_test(testsuite, testarea, logger):
db_result = Report.get_result(testcase)
Report.check_result(testcase, db_result)
+ return duration
+
def validate_options(input_dict, logger):
# for 'tag' option
@@ -160,8 +167,8 @@ def main(*args, **kwargs):
if testsuite_validation and testarea_validation:
testsuite_yaml = load_testsuite(kwargs['testsuite'])
load_testcase()
- run_test(testsuite_yaml, testarea, logger)
- Report.generate(testsuite_yaml, testarea)
+ duration = run_test(testsuite_yaml, testarea, logger)
+ Report.generate(testsuite_yaml, testarea, duration)
else:
logger.error('invalid input commands, testsuite %s testarea %s' %
(kwargs['testsuite'], testarea))