X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Ftest%2Fresult_collection_api%2Fresult_collection_api.py;h=69c03b8998b83ab57a446ac234e5e5b6778b822c;hb=23583a68f520cb3a8f68c091cf33c752ac302ee2;hp=c04e0343ba88f875a21674a5d16e32a454f2181e;hpb=f0c991c665f57b2344a6b8ed23ff62d44612fc19;p=releng.git diff --git a/utils/test/result_collection_api/result_collection_api.py b/utils/test/result_collection_api/result_collection_api.py index c04e0343b..69c03b899 100644 --- a/utils/test/result_collection_api/result_collection_api.py +++ b/utils/test/result_collection_api/result_collection_api.py @@ -15,14 +15,12 @@ Pre-requisites: We can launch the API with this file TODOs : - - use POD name instead of id - logging - json args validation with schemes - POST/PUT/DELETE for PODs - POST/PUT/GET/DELETE for installers, platforms (enrich results info) - count cases for GET on test_projects - count results for GET on cases - - provide filtering on requests - include objects - swagger documentation - setup file @@ -36,7 +34,7 @@ import motor import argparse from resources.handlers import VersionHandler, PodHandler, \ - TestProjectHandler, TestCasesHandler, TestResultsHandler + TestProjectHandler, TestCasesHandler, TestResultsHandler, DashboardHandler from common.config import APIConfig @@ -48,7 +46,8 @@ args = parser.parse_args() CONF = APIConfig().parse(args.config_file) # connecting to MongoDB server, and choosing database -db = motor.MotorClient(CONF.mongo_url) +client = motor.MotorClient(CONF.mongo_url) +db = client[CONF.mongo_dbname] def make_app(): @@ -61,7 +60,7 @@ def make_app(): # GET /pods => Get all pods # GET /pods/1 => Get details on POD 1 (r"/pods", PodHandler), - (r"/pods/(\d*)", PodHandler), + (r"/pods/([^/]+)", PodHandler), # few examples: # GET /test_projects @@ -81,10 +80,19 @@ def make_app(): # => get results with optional filters # POST /results => # Push results with mandatory request payload parameters - # (project, case, and pod_id) + # (project, case, and pod) (r"/results", TestResultsHandler), (r"/results([^/]*)", TestResultsHandler), (r"/results/([^/]*)", TestResultsHandler), + + # Method to manage Dashboard ready results + # GET /dashboard?project=functest&case=vPing&pod=opnfv-jump2 + # => get results in dasboard ready format + # get /dashboard + # => get the list of project with dashboard ready results + (r"/dashboard", DashboardHandler), + (r"/dashboard([^/]*)", DashboardHandler), + (r"/dashboard/([^/]*)", DashboardHandler), ], db=db, debug=CONF.api_debug_on,