diff options
Diffstat (limited to 'utils/test')
9 files changed, 42 insertions, 36 deletions
diff --git a/utils/test/result_collection_api/dashboard/bottlenecks2Dashboard.py b/utils/test/result_collection_api/dashboard/bottlenecks2Dashboard.py index 9a7e4ce1b..2e106bec8 100755 --- a/utils/test/result_collection_api/dashboard/bottlenecks2Dashboard.py +++ b/utils/test/result_collection_api/dashboard/bottlenecks2Dashboard.py @@ -67,7 +67,7 @@ def format_rubbos_for_dashboard(results): #new_element = [] #for each_result in results: # throughput_data = [record['throughput'] for record in each_result['details']] - # new_element.append({'x': each_result['creation_date'], + # new_element.append({'x': each_result['start_date'], # 'y': max(throughput_data)}) #test_data.append({'name': "Rubbos max throughput", diff --git a/utils/test/result_collection_api/dashboard/doctor2Dashboard.py b/utils/test/result_collection_api/dashboard/doctor2Dashboard.py index eba35b57b..38b23abb4 100644 --- a/utils/test/result_collection_api/dashboard/doctor2Dashboard.py +++ b/utils/test/result_collection_api/dashboard/doctor2Dashboard.py @@ -78,7 +78,7 @@ def format_doctor_notification_case_for_dashboard(results): # consider only seconds => 09 for data in results: t = data['details']['duration'] - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y': t}) test_data.append({'name': "doctor-notification duration ", diff --git a/utils/test/result_collection_api/dashboard/functest2Dashboard.py b/utils/test/result_collection_api/dashboard/functest2Dashboard.py index 379b93279..86521b984 100644 --- a/utils/test/result_collection_api/dashboard/functest2Dashboard.py +++ b/utils/test/result_collection_api/dashboard/functest2Dashboard.py @@ -89,7 +89,7 @@ def format_vIMS_for_dashboard(results): new_element = [] for data in results: - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y1': data['details']['orchestrator']['duration'], 'y2': data['details']['vIMS']['duration'], 'y3': data['details']['sig_test']['duration']}) @@ -127,7 +127,7 @@ def format_vIMS_for_dashboard(results): except: nbTests = 0 - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y1': nbTests, 'y2': nbFailures, 'y3': nbSkipped}) @@ -181,7 +181,7 @@ def format_Tempest_for_dashboard(results): # ******************************** new_element = [] for data in results: - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y': data['details']['duration']}) test_data.append({'name': "Tempest duration", @@ -194,7 +194,7 @@ def format_Tempest_for_dashboard(results): # *************************************** new_element = [] for data in results: - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y1': data['details']['tests'], 'y2': data['details']['failures']}) @@ -229,7 +229,7 @@ def format_Tempest_for_dashboard(results): except: success_rate = 0 - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y1': success_rate}) test_data.append({'name': "Tempest success rate", @@ -257,7 +257,7 @@ def format_ODL_for_dashboard(results): for odl in odl_results: if (odl['test_status']['@status'] == "FAIL"): nbFailures += 1 - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y1': len(odl_results), 'y2': nbFailures}) @@ -288,7 +288,7 @@ def format_ONOS_for_dashboard(results): new_duration = int(datetime.timedelta(hours=int(h), minutes=int(m), seconds=int(s)).total_seconds()) - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y': new_duration}) test_data.append({'name': "ONOS FUNCvirNet duration ", @@ -307,7 +307,7 @@ def format_ONOS_for_dashboard(results): for onos in onos_results: if (onos['Case result'] == "FAIL"): nbFailures += 1 - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y1': len(onos_results), 'y2': nbFailures}) @@ -331,7 +331,7 @@ def format_ONOS_for_dashboard(results): new_duration = int(datetime.timedelta(hours=int(h), minutes=int(m), seconds=int(s)).total_seconds()) - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y': new_duration}) test_data.append({'name': "ONOS FUNCvirNetL3 duration", @@ -350,7 +350,7 @@ def format_ONOS_for_dashboard(results): for onos in onos_results: if (onos['Case result'] == "FAIL"): nbFailures += 1 - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y1': len(onos_results), 'y2': nbFailures}) @@ -373,7 +373,7 @@ def format_Rally_for_dashboard(results): new_element = [] for data in results: summary_cursor = len(data['details']) - 1 - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y': int(data['details'][summary_cursor]['summary']['duration'])}) test_data.append({'name': "rally duration", @@ -386,7 +386,7 @@ def format_Rally_for_dashboard(results): # ******************************** new_element = [] for data in results: - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y': float(data['details'][summary_cursor]['summary']['nb success'])}) test_data.append({'name': "rally success rate", @@ -408,7 +408,7 @@ def format_vPing_for_dashboard(results): # ******************************** new_element = [] for data in results: - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y': data['details']['duration']}) test_data.append({'name': "vPing duration", @@ -445,7 +445,7 @@ def format_vPing_userdata_for_dashboard(results): # ******************************** new_element = [] for data in results: - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y': data['details']['duration']}) test_data.append({'name': "vPing_userdata duration", diff --git a/utils/test/result_collection_api/dashboard/qtip2Dashboard.py b/utils/test/result_collection_api/dashboard/qtip2Dashboard.py index 0112945b1..6ceccd374 100644 --- a/utils/test/result_collection_api/dashboard/qtip2Dashboard.py +++ b/utils/test/result_collection_api/dashboard/qtip2Dashboard.py @@ -93,7 +93,7 @@ def _get_results(db_url, testcase): rawresults = datajson['test_results'][x]['details'] index = rawresults['index'] - resultarray[str(datajson['test_results'][x]['creation_date'])]=index + resultarray[str(datajson['test_results'][x]['start_date'])]=index return resultarray diff --git a/utils/test/result_collection_api/dashboard/vsperf2Dashboard.py b/utils/test/result_collection_api/dashboard/vsperf2Dashboard.py index 323d3915c..5a6882da4 100755 --- a/utils/test/result_collection_api/dashboard/vsperf2Dashboard.py +++ b/utils/test/result_collection_api/dashboard/vsperf2Dashboard.py @@ -79,7 +79,7 @@ def format_common_for_dashboard(case, results): # ******************************** new_element = [] for data in results: - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y1': data['details']['64'], 'y2': data['details']['128'], 'y3': data['details']['512'], @@ -105,8 +105,8 @@ def format_common_for_dashboard(case, results): import os def _test(): - ans = [{'creation_date': '2015-09-12', 'project_name': 'vsperf', 'version': 'ovs_master', 'pod_name': 'pod1-vsperf', 'case_name': 'tput_ovsdpdk', 'installer': 'build_sie', 'details': {'64': '26.804', '1024': '1097.284', '512': '178.137', '1518': '12635.860', '128': '100.564'}}, - {'creation_date': '2015-09-33', 'project_name': 'vsperf', 'version': 'ovs_master', 'pod_name': 'pod1-vsperf', 'case_name': 'tput_ovsdpdk', 'installer': 'build_sie', 'details': {'64': '16.804', '1024': '1087.284', '512': '168.137', '1518': '12625.860', '128': '99.564'}}] + ans = [{'start_date': '2015-09-12', 'project_name': 'vsperf', 'version': 'ovs_master', 'pod_name': 'pod1-vsperf', 'case_name': 'tput_ovsdpdk', 'installer': 'build_sie', 'details': {'64': '26.804', '1024': '1097.284', '512': '178.137', '1518': '12635.860', '128': '100.564'}}, + {'start_date': '2015-09-33', 'project_name': 'vsperf', 'version': 'ovs_master', 'pod_name': 'pod1-vsperf', 'case_name': 'tput_ovsdpdk', 'installer': 'build_sie', 'details': {'64': '16.804', '1024': '1087.284', '512': '168.137', '1518': '12625.860', '128': '99.564'}}] result = format_vsperf_for_dashboard("pvp_cont_ovsdpdkcuse", ans) print result diff --git a/utils/test/result_collection_api/dashboard/yardstick2Dashboard.py b/utils/test/result_collection_api/dashboard/yardstick2Dashboard.py index 20b086496..4f022d5b9 100644 --- a/utils/test/result_collection_api/dashboard/yardstick2Dashboard.py +++ b/utils/test/result_collection_api/dashboard/yardstick2Dashboard.py @@ -84,7 +84,7 @@ def format_Ping_for_dashboard(results): if "benchmark" in record] avg_rtt = sum(records) / len(records) - new_element.append({'x': data['creation_date'], + new_element.append({'x': data['start_date'], 'y': avg_rtt}) test_data.append({'name': "ping duration", diff --git a/utils/test/result_collection_api/resources/handlers.py b/utils/test/result_collection_api/resources/handlers.py index 268d19aba..8cc68e912 100644 --- a/utils/test/result_collection_api/resources/handlers.py +++ b/utils/test/result_collection_api/resources/handlers.py @@ -620,9 +620,6 @@ class TestResultsHandler(GenericApiHandler): "Could not find testcase [{}] " .format(result.case_name)) - # convert payload to object - result.creation_date = datetime.now() - _id = yield self.db.results.insert(result.format(), check_keys=False) self.finish_request(self._create_response(_id)) diff --git a/utils/test/result_collection_api/resources/result_models.py b/utils/test/result_collection_api/resources/result_models.py index 795621ab1..15684e229 100644 --- a/utils/test/result_collection_api/resources/result_models.py +++ b/utils/test/result_collection_api/resources/result_models.py @@ -6,7 +6,8 @@ class ResultCreateRequest(object): case_name=None, installer=None, version=None, - description=None, + start_date=None, + stop_date=None, details=None, build_tag=None, scenario=None, @@ -17,7 +18,8 @@ class ResultCreateRequest(object): self.case_name = case_name self.installer = installer self.version = version - self.description = description + self.start_date = start_date + self.stop_date = stop_date self.details = details self.build_tag = build_tag self.scenario = scenario @@ -31,7 +33,8 @@ class ResultCreateRequest(object): "case_name": self.case_name, "installer": self.installer, "version": self.version, - "description": self.description, + "start_date": self.start_date, + "stop_date": self.stop_date, "details": self.details, "build_tag": self.build_tag, "scenario": self.scenario, @@ -50,8 +53,8 @@ class TestResult: self.pod_name = None self.installer = None self.version = None - self.description = None - self.creation_date = None + self.start_date = None + self.stop_date = None self.details = None self.build_tag = None self.scenario = None @@ -70,7 +73,8 @@ class TestResult: t.pod_name = a_dict.get('pod_name') t.project_name = a_dict.get('project_name') t.description = a_dict.get('description') - t.creation_date = str(a_dict.get('creation_date')) + t.start_date = str(a_dict.get('start_date')) + t.stop_date = str(a_dict.get('stop_date')) t.details = a_dict.get('details') t.version = a_dict.get('version') t.installer = a_dict.get('installer') @@ -98,7 +102,8 @@ class TestResult: "project_name": self.project_name, "pod_name": self.pod_name, "description": self.description, - "creation_date": str(self.creation_date), + "start_date": str(self.start_date), + "stop_date": str(self.stop_date), "version": self.version, "installer": self.installer, "details": self.details, @@ -115,7 +120,8 @@ class TestResult: "project_name": self.project_name, "pod_name": self.pod_name, "description": self.description, - "creation_date": str(self.creation_date), + "start_date": str(self.start_date), + "stop_date": str(self.stop_date), "version": self.version, "installer": self.installer, "details": self.details, diff --git a/utils/test/result_collection_api/tests/unit/test_result.py b/utils/test/result_collection_api/tests/unit/test_result.py index 2ea1b6c11..9e27e3c3c 100644 --- a/utils/test/result_collection_api/tests/unit/test_result.py +++ b/utils/test/result_collection_api/tests/unit/test_result.py @@ -47,8 +47,10 @@ class TestResultBase(TestBase): self.version = 'C' self.build_tag = 'v3.0' self.scenario = 'odl-l2' - self.criteria = '10s' + self.criteria = 'passed' self.trust_indicator = 0.7 + self.start_date = "2016-05-23 07:16:09.477097" + self.stop_date = "2016-05-23 07:16:19.477097" super(TestResultBase, self).setUp() self.details = Details(timestart='0', duration='9s', status='OK') self.req_d = ResultCreateRequest(pod_name=self.pod, @@ -56,7 +58,8 @@ class TestResultBase(TestBase): case_name=self.case, installer=self.installer, version=self.version, - description='vping use ssh', + start_date=self.start_date, + stop_date=self.stop_date, details=self.details.format(), build_tag=self.build_tag, scenario=self.scenario, @@ -82,7 +85,6 @@ class TestResultBase(TestBase): self.assertEqual(result.case_name, req.case_name) self.assertEqual(result.installer, req.installer) self.assertEqual(result.version, req.version) - self.assertEqual(result.description, req.description) details_req = Details.from_dict(req.details) details_res = Details.from_dict(result.details) self.assertEqual(details_res.duration, details_req.duration) @@ -92,7 +94,8 @@ class TestResultBase(TestBase): self.assertEqual(result.scenario, req.scenario) self.assertEqual(result.criteria, req.criteria) self.assertEqual(result.trust_indicator, req.trust_indicator) - self.assertIsNotNone(result.creation_date) + self.assertIsNotNone(result.start_date) + self.assertIsNotNone(result.stop_date) self.assertIsNotNone(result._id) |