diff options
-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 565a0e5d..a059ca3c 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_suite_in_test_list(args["suite_name"]): return abort(404, 'message:Test suite {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 59e011ef..2f9eebf1 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') |