summaryrefslogtreecommitdiffstats
path: root/dashboard
diff options
context:
space:
mode:
authorMofassirArif <Mofassir_Arif@dellteam.com>2016-01-15 04:29:23 -0800
committerMofassirArif <Mofassir_Arif@dellteam.com>2016-01-15 04:29:23 -0800
commit9cff8cab939a91867f413d2ecdf09aa93f40bfc0 (patch)
tree263024e6ca8034bfa23f73d7ef678328f18fb6ae /dashboard
parentbec658afadacfeeca9fbfbe598ceb5c5601a3372 (diff)
bug fix in pushtodb
Change-Id: I2cba0a805275ebae8b79a968cc8d725dcc96504a Signed-off-by: MofassirArif <Mofassir_Arif@dellteam.com>
Diffstat (limited to 'dashboard')
-rw-r--r--dashboard/pushtoDB.py27
-rw-r--r--dashboard/qtip2dashboard.py97
2 files changed, 10 insertions, 114 deletions
diff --git a/dashboard/pushtoDB.py b/dashboard/pushtoDB.py
index b889f21c..d9d48f5a 100644
--- a/dashboard/pushtoDB.py
+++ b/dashboard/pushtoDB.py
@@ -7,24 +7,20 @@ TEST_DB = 'http://213.77.62.197'
suite_list = [('compute_result.json', 'compute_test_suite'),('network_result.json', 'network_test_suite'),('storage_result.json', 'storage_test_suite')]
payload_list = { }
-def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-us-testing-1"):
+def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-us-testing-bm-1"):
url = db_url + "/results"
creation_date= str(datetime.datetime.utcnow().isoformat())
installer = os.environ['INSTALLER_TYPE']
- #pod_name = os.environ['NODE_NAME']
- print url
- print case_name
- print logger
- print pod_name
-
+ pod_name = os.environ['NODE_NAME']
+
params = {"project_name": "qtip", "case_name": case_name,
"pod_name": pod_name, "installer": installer, "creation_date": creation_date,
"version": "test" , "details": payload}
headers = {'Content-Type': 'application/json'}
- print params
-
+ print json.dumps(params)
+
try:
r = requests.post(url, data=json.dumps(params), headers=headers)
print r
@@ -32,26 +28,23 @@ def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-us
except:
print "Error:", sys.exc_info()[0]
return False
-
+
def populate_payload(suite_list):
global payload_list
for k,v in suite_list:
- print 'results/'+k
+
if os.path.isfile('results/'+str(k)):
payload_list[k]=v
-
- print payload_list
def main():
global payload_list
populate_payload(suite_list)
for suite,case in payload_list.items():
- with open('results/'+suite,'r') as result_file:
- j=result_file.read().rstrip()
-
- push_results_to_db(TEST_DB, 'Compute benchmark suite',j)
+ with open('results/'+suite,'r') as result_file:
+ j=json.load(result_file)
+ push_results_to_db(TEST_DB, case , j)
if __name__ == "__main__":
main()
diff --git a/dashboard/qtip2dashboard.py b/dashboard/qtip2dashboard.py
deleted file mode 100644
index 3eab96cc..00000000
--- a/dashboard/qtip2dashboard.py
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/python
-
-##############################################################################
-# Copyright (c) 2015 Dell Inc and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-asfdasd
-def get_qtip_cases():
- """
- get the list of the supported test cases
- TODO: update the list when adding a new test case for the dashboard
- """
- return ["compute_test_suite","storage_test_suite","network_test_suite"]
-
-
-def check_qtip_case_exist(case):
- """
- check if the testcase exists
- if the test case is not defined or not declared in the list
- return False
- """
- qtip_cases = get_qtip_cases()
-
- if (case is None or case not in qtip_cases):
- return False
- else:
- return True
-
-
-def format_qtip_for_dashboard(case, results):
- """
- generic method calling the method corresponding to the test case
- check that the testcase is properly declared first
- then build the call to the specific method
- """
- if check_qtip_case_exist(case):
- res = format_common_for_dashboard(case, results)
- else:
- res = []
- print "Test cases not declared"
- return res
-
-def format_common_for_dashboard(case, results):
- """
- Common post processing
- """
- test_data_description = case + " results for Dashboard"
- test_data = [{'description': test_data_description}]
-
- graph_name = ''
- if "network_test_suite" in case:
- graph_name = "Throughput index"
- else:
- graph_name = "Index"
-
- # Graph 1: Rx fps = f(time)
- # ********************************
- new_element = []
- for data in results:
- new_element.append({'x': data['creation_date'],
- 'y1': data['details']['index'],
- })
-
- test_data.append({'name': graph_name,
- 'info': {'type': "graph",
- 'xlabel': 'time',
- 'y1label': 'Index Number'},
- 'data_set': new_element})
-
- return test_data
-
-
-
-
-############################ For local test ################################
-import os
-
-def _test():
- ans = [{'creation_date': '2015-09-12', 'project_name': 'qtip', 'version': 'test', 'pod_name': 'dell-us-testing-1', 'case_name': 'compute_test_suite', 'installer': 'fuel', 'details': {'index': '0.9'}},
- {'creation_date': '2015-09-33', 'project_name': 'qtip', 'version': 'test', 'pod_name': 'dell-us-testing-1', 'case_name': 'compute_test_suite', 'installer': 'fuel', 'details': {'index': '0.8'}}]
-
- result = format_qtip_for_dashboard("compute_test_suite", ans)
- print result
-
- result = format_qtip_for_dashboard("storage_test_suite", ans)
- print result
-
- result = format_qtip_for_dashboard("network_test_suite", ans)
- print result
-
-if __name__ == '__main__':
- _test() \ No newline at end of file