diff options
author | zhifeng.jiang <jiang.zhifeng@zte.com.cn> | 2016-10-07 15:55:59 +0800 |
---|---|---|
committer | zhifeng.jiang <jiang.zhifeng@zte.com.cn> | 2016-10-10 20:58:59 +0800 |
commit | 97c34c1840de3b3812b306b2b3d6fc354862196a (patch) | |
tree | feb158629d5b12a11b919049a2ee1bd5ff8dadb0 | |
parent | 49a6694e6c286a12fcdc3b130315b92c1445e05b (diff) |
Add testdb url and node_name in post parameters of restful server
JIRA:QTIP-99
Change-Id: I67f56eafba48ca096570674f5de2ff5aeb935d16
Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
-rw-r--r-- | restful_server/db.py | 2 | ||||
-rw-r--r-- | restful_server/qtip_server.py | 19 | ||||
-rw-r--r-- | tests/qtip_server_test.py | 8 |
3 files changed, 24 insertions, 5 deletions
diff --git a/restful_server/db.py b/restful_server/db.py index 8da64187..24fc27a5 100644 --- a/restful_server/db.py +++ b/restful_server/db.py @@ -25,6 +25,8 @@ def create_job(args): 'suite_name': args["suite_name"], 'max_minutes': args["max_minutes"], 'type': args["type"], + 'testdb_url': args["testdb_url"], + 'node_name': args["node_name"], 'start_time': str(datetime.now()), 'end_time': None, 'state': 'processing', diff --git a/restful_server/qtip_server.py b/restful_server/qtip_server.py index a059ca3c..f2676595 100644 --- a/restful_server/qtip_server.py +++ b/restful_server/qtip_server.py @@ -28,7 +28,9 @@ class JobModel: 'pod_name': fields.String, 'suite_name': fields.String, 'type': fields.String, - 'benchmark_name': fields.String + 'benchmark_name': fields.String, + 'testdb_url': fields.String, + 'node_name': fields.String } required = ['installer_type', 'installer_ip'] @@ -98,10 +100,16 @@ for any single test iteration, default is '60', "pod_name": If specified, the Pod name, default is 'default', "suite_name": If specified, Test suite name, for example 'compute', 'network', 'storage', -default is 'compute' -"type": BM or VM,default is 'BM' +default is 'compute', + +"type": BM or VM,default is 'BM', + "benchmark_name": If specified, benchmark name in suite, for example 'dhrystone_bm.yaml', -default is all benchmarks in suite with specified type +default is all benchmarks in suite with specified type, + +"testdb_url": test db http url, for example 'http://testresults.opnfv.org/test/api/v1', + +"node_name": node name reported to test db """, "required": True, "type": "JobModel", @@ -133,6 +141,9 @@ default is all benchmarks in suite with specified type parser.add_argument('suite_name', type=str, required=False, default='compute', help='suite_name should be string') parser.add_argument('type', type=str, required=False, default='BM', help='type should be BM, VM and ALL') parser.add_argument('benchmark_name', type=str, required=False, default='all', help='benchmark_name should be string') + parser.add_argument('testdb_url', type=str, required=False, default=None, + help='testdb_url should be test db http url,for example http://testresults.opnfv.org/test/api/v1') + parser.add_argument('node_name', type=str, required=False, default=None, help='node_name should be string') args = parser.parse_args() if not args_handler.check_suite_in_test_list(args["suite_name"]): return abort(404, 'message:Test suite {0} does not exist in test_list'.format(args["suite_name"])) diff --git a/tests/qtip_server_test.py b/tests/qtip_server_test.py index 2f9eebf1..9def21f8 100644 --- a/tests/qtip_server_test.py +++ b/tests/qtip_server_test.py @@ -35,6 +35,8 @@ class TestClass: 'suite_name': 'compute', 'max_minutes': 60, 'type': 'BM', + 'testdb_url': None, + 'node_name': None, 'state': 'finished', 'state_detail': [{'state': 'finished', 'benchmark': 'dhrystone_bm.yaml'}, {'state': 'finished', 'benchmark': 'whetstone_bm.yaml'}, @@ -48,7 +50,9 @@ class TestClass: 'max_minutes': 20, 'suite_name': 'compute', 'type': 'VM', - 'benchmark_name': 'dhrystone_vm.yaml'}, + 'benchmark_name': 'dhrystone_vm.yaml', + 'testdb_url': 'http://testresults.opnfv.org/test/api/v1', + 'node_name': 'zte-pod2'}, {'job_id': '', 'installer_type': 'fuel', 'installer_ip': '10.20.0.2', @@ -56,6 +60,8 @@ class TestClass: 'suite_name': 'compute', 'max_minutes': 20, 'type': 'VM', + 'testdb_url': 'http://testresults.opnfv.org/test/api/v1', + 'node_name': 'zte-pod2', 'state': 'finished', 'state_detail': [{u'state': u'finished', u'benchmark': u'dhrystone_vm.yaml'}], 'result': 0}) |