diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-05-23 18:34:19 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-05-25 15:14:28 +0800 |
commit | f4f8328db358131963b3fa9e81677bf570b8d0aa (patch) | |
tree | 611efe5271abc45869ac164e79323f70c6783641 /utils/test/result_collection_api/dashboard | |
parent | 2e273acb2bb50394182575b1322b47ce17f8e53d (diff) |
add test result/dashboard related unittests in testAPI and refactor its response
modification:
add unittests for test result/dashboard
rename test_results table name in db to results
refactor response body
JIRA: FUNCTEST-255
Change-Id: I0657e6e95156a8c79072e7333fd8aaeb12d986e5
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/result_collection_api/dashboard')
-rw-r--r-- | utils/test/result_collection_api/dashboard/dashboard_utils.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/utils/test/result_collection_api/dashboard/dashboard_utils.py b/utils/test/result_collection_api/dashboard/dashboard_utils.py index 472bbc727..bfa743223 100644 --- a/utils/test/result_collection_api/dashboard/dashboard_utils.py +++ b/utils/test/result_collection_api/dashboard/dashboard_utils.py @@ -16,6 +16,7 @@ # import os import re +import sys from functest2Dashboard import format_functest_for_dashboard, \ check_functest_case_exist from yardstick2Dashboard import format_yardstick_for_dashboard, \ @@ -37,16 +38,12 @@ from doctor2Dashboard import format_doctor_for_dashboard, \ # - check_<Project>_case_exist -def check_dashboard_ready_project(test_project, path): +def check_dashboard_ready_project(test_project): # Check that the first param corresponds to a project # for whoch dashboard processing is available - subdirectories = os.listdir(path) - for testfile in subdirectories: - m = re.search('^(.*)(2Dashboard.py)$', testfile) - if m: - if (m.group(1) == test_project): - return True - return False + # print("test_project: %s" % test_project) + project_module = 'dashboard.'+test_project + '2Dashboard' + return True if project_module in sys.modules else False def check_dashboard_ready_case(project, case): @@ -54,21 +51,20 @@ def check_dashboard_ready_case(project, case): return eval(cmd) -def get_dashboard_cases(path): +def get_dashboard_cases(): # Retrieve all the test cases that could provide # Dashboard ready graphs # look in the releng repo # search all the project2Dashboard.py files # we assume that dashboard processing of project <Project> # is performed in the <Project>2Dashboard.py file - dashboard_test_cases = [] - subdirectories = os.listdir(path) - for testfile in subdirectories: - m = re.search('^(.*)(2Dashboard.py)$', testfile) - if m: - dashboard_test_cases.append(m.group(1)) + modules = [] + cp = re.compile('dashboard.*2Dashboard') + for module in sys.modules: + if re.match(cp, module): + modules.append(module) - return dashboard_test_cases + return modules def get_dashboard_result(project, case, results): |