diff options
author | zhifeng.jiang <jiang.zhifeng@zte.com.cn> | 2016-10-06 15:32:37 +0800 |
---|---|---|
committer | zhifeng.jiang <jiang.zhifeng@zte.com.cn> | 2016-10-07 06:40:20 +0800 |
commit | 248e724a636907c5629ade8fe9febf6a3cec1dc6 (patch) | |
tree | c11d4c0ad5a80a6a404fcf534d859f758bd090e1 | |
parent | 16385d37f66e121d0ef045e679ade1fd1aec9afc (diff) |
Add benchmark name in post request parameters
Change-Id: I53974789d59f316afa72fb753397baa45247e64c
Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
-rw-r--r-- | restful_server/qtip_server.py | 13 | ||||
-rw-r--r-- | tests/qtip_server_test.py | 9 |
2 files changed, 14 insertions, 8 deletions
diff --git a/restful_server/qtip_server.py b/restful_server/qtip_server.py index 734a471c..e036a1cb 100644 --- a/restful_server/qtip_server.py +++ b/restful_server/qtip_server.py @@ -27,9 +27,10 @@ class JobModel: 'max-minutes': fields.Integer, 'pod_name': fields.String, 'suite_name': fields.String, - 'type': fields.String + 'type': fields.String, + 'benchmark_name': fields.String } - required = ['installer_type', 'install_ip'] + required = ['installer_type', 'installer_ip'] @swagger.model @@ -99,6 +100,8 @@ for any single test iteration, default is '60', "suite_name": If specified, Test suite name, for example 'compute', 'network', 'storage', 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 """, "required": True, "type": "JobModel", @@ -129,6 +132,7 @@ default is 'compute' parser.add_argument('pod_name', type=str, required=False, default='default', help='pod_name should be string') 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') args = parser.parse_args() if not args_handler.check_suit_in_test_list(args["suite_name"]): return abort(404, 'message:Test Suit {0} does not exist in test_list'.format(args["suite_name"])) @@ -146,6 +150,11 @@ default is 'compute' args["suite_name"], args["type"].lower()) benchmarks_list = filter(lambda x: x in test_cases, benchmarks) + if args["benchmark_name"] in benchmarks_list: + benchmarks_list = [args["benchmark_name"]] + if (args["benchmark_name"] is not 'all') and args["benchmark_name"] not in benchmarks_list: + return abort(404, 'message: Benchmark name {0} does not exist in suit {1}'.format(args["benchmark_name"], + args["suite_name"])) state_detail = map(lambda x: {'benchmark': x, 'state': 'idle'}, benchmarks_list) db.update_job_state_detail(job_id, copy(state_detail)) thread_stop = threading.Event() diff --git a/tests/qtip_server_test.py b/tests/qtip_server_test.py index 511d209a..6659fc07 100644 --- a/tests/qtip_server_test.py +++ b/tests/qtip_server_test.py @@ -47,7 +47,8 @@ class TestClass: 'pod_name': 'zte-pod1', 'max-minutes': 20, 'suite_name': 'compute', - 'type': 'VM'}, + 'type': 'VM', + 'benchmark_name': 'dhrystone_vm.yaml'}, {'job_id': '', 'installer_type': 'fuel', 'installer_ip': '10.20.0.2', @@ -56,11 +57,7 @@ class TestClass: 'max-minutes': 20, 'type': 'VM', 'state': 'finished', - 'state_detail': [{u'state': u'finished', u'benchmark': u'dhrystone_vm.yaml'}, - {u'state': u'finished', u'benchmark': u'whetstone_vm.yaml'}, - {u'state': u'finished', u'benchmark': u'ramspeed_vm.yaml'}, - {u'state': u'finished', u'benchmark': u'dpi_vm.yaml'}, - {u'state': u'finished', u'benchmark': u'ssl_vm.yaml'}], + 'state_detail': [{u'state': u'finished', u'benchmark': u'dhrystone_vm.yaml'}], 'result': 0}) ]) @mock.patch('restful_server.qtip_server.args_handler.prepare_and_run_benchmark') |