summaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-08-23 14:31:31 +0100
committerMartin Klozik <martinx.klozik@intel.com>2017-08-23 15:18:14 +0100
commitc9ae2766fd566358a1ac3a38a7dc6f7b22a3449f (patch)
tree81c1e918112dc2fa2d0f3120b241fe55f4df83f8 /testcases
parent1375b9eff007b51af9b04b4c36975c39cc04cde8 (diff)
opnfvresultdb: Update data reported to result DB
Data reported to result DB were updated to comply with recent API version and requirements. JIRA: VSPERF-488 Change-Id: I6ab02ea54d99099e88b0d5ab6e9745ee8297f544 Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Signed-off-by: Mars Toktonaliev <mars.toktonaliev@nokia.com> Signed-off-by: Morgan Richomme <morgan.richomme@orange.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com> Reviewed-by: Trevor Cooper <trevor.cooper@intel.com>
Diffstat (limited to 'testcases')
-rw-r--r--testcases/testcase.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/testcases/testcase.py b/testcases/testcase.py
index a213bbe8..01b3a975 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -24,6 +24,7 @@ import re
import time
import subprocess
+from datetime import datetime as dt
from conf import settings as S
from conf import get_test_param, merge_spec
import core.component_factory as component_factory
@@ -58,6 +59,7 @@ class TestCase(object):
cfg = copy.deepcopy(test_cfg)
self._testcase_start_time = time.time()
+ self._testcase_stop_time = self._testcase_start_time
self._hugepages_mounted = False
self._traffic_ctl = None
self._vnf_ctl = None
@@ -355,8 +357,9 @@ class TestCase(object):
# tear down test execution environment and log results
self.run_finalize()
+ self._testcase_stop_time = time.time()
self._testcase_run_time = time.strftime("%H:%M:%S",
- time.gmtime(time.time() -
+ time.gmtime(self._testcase_stop_time -
self._testcase_start_time))
logging.info("Testcase execution time: " + self._testcase_run_time)
# report test results
@@ -394,6 +397,11 @@ class TestCase(object):
item[ResultsConstants.VSWITCH] = S.getValue('VSWITCH')
item[ResultsConstants.TRAFFIC_TYPE] = self._traffic['l3']['proto']
item[ResultsConstants.TEST_RUN_TIME] = self._testcase_run_time
+ # convert timestamps to human readable format
+ item[ResultsConstants.TEST_START_TIME] = dt.fromtimestamp(
+ self._testcase_start_time).strftime('%Y-%m-%d %H:%M:%S')
+ item[ResultsConstants.TEST_STOP_TIME] = dt.fromtimestamp(
+ self._testcase_stop_time).strftime('%Y-%m-%d %H:%M:%S')
if self._traffic['multistream']:
item[ResultsConstants.SCAL_STREAM_COUNT] = self._traffic['multistream']
item[ResultsConstants.SCAL_STREAM_TYPE] = self._traffic['stream_type']