Rename 'max-minutes' to 'max_minutes' 71/22771/2
authorYujun Zhang <zhang.yujunz@zte.com.cn>
Fri, 7 Oct 2016 05:52:03 +0000 (13:52 +0800)
committerYujun Zhang <zhang.yujunz@zte.com.cn>
Fri, 7 Oct 2016 07:31:59 +0000 (15:31 +0800)
The naming style of query param should be consistent

Change-Id: Ifb9bb3ecfbbf8caee7a00d3968a627c35d965bcb
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
restful_server/db.py
restful_server/qtip_server.py
tests/qtip_server_test.py

index cf6ebfb..75f3e1b 100644 (file)
@@ -23,7 +23,7 @@ def create_job(args):
                'installer_ip': args["installer_ip"],
                'pod_name': args["pod_name"],
                'suite_name': args["suite_name"],
-               'max-minutes': args["max-minutes"],
+               'max_minutes': args["max_minutes"],
                'type': args["type"],
                'start_time': str(datetime.now()),
                'end_time': None,
@@ -73,7 +73,7 @@ def update_job_result_detail(job_id, benchmark, result):
 def is_job_timeout(job_id):
     period = datetime.now() - datetime.strptime(jobs[job_id]['start_time'],
                                                 "%Y-%m-%d %H:%M:%S.%f")
-    return True if jobs[job_id]['max-minutes'] * 60 < period.total_seconds()\
+    return True if jobs[job_id]['max_minutes'] * 60 < period.total_seconds()\
         else False
 
 
index 734a471..04d4f9e 100644 (file)
@@ -24,7 +24,7 @@ class JobModel:
     resource_fields = {
         'installer_type': fields.String,
         'installer_ip': fields.String,
-        'max-minutes': fields.Integer,
+        'max_minutes': fields.Integer,
         'pod_name': fields.String,
         'suite_name': fields.String,
         'type': fields.String
@@ -91,7 +91,7 @@ class JobList(Resource):
 
 "installer_ip": The installer ip of the pod,
 
-"max-minutes": If specified, the maximum duration in minutes
+"max_minutes": If specified, the maximum duration in minutes
 for any single test iteration, default is '60',
 
 "pod_name": If specified, the Pod name, default is 'default',
@@ -123,9 +123,9 @@ default is 'compute'
     )
     def post(self):
         parser = reqparse.RequestParser()
-        parser.add_argument('installer_type', type=str, required=True, help='Installer_type is required')
-        parser.add_argument('installer_ip', type=str, required=True, help='Installer_ip is required')
-        parser.add_argument('max-minutes', type=int, required=False, default=60, help='max-minutes should be integer')
+        parser.add_argument('installer_type', type=str, required=True, help='installer_type is required')
+        parser.add_argument('installer_ip', type=str, required=True, help='installer_ip is required')
+        parser.add_argument('max_minutes', type=int, required=False, default=60, help='max_minutes should be integer')
         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')
index 511d209..59e011e 100644 (file)
@@ -33,7 +33,7 @@ class TestClass:
           'installer_ip': '10.20.0.2',
           'pod_name': 'default',
           'suite_name': 'compute',
-          'max-minutes': 60,
+          'max_minutes': 60,
           'type': 'BM',
           'state': 'finished',
           'state_detail': [{'state': 'finished', 'benchmark': 'dhrystone_bm.yaml'},
@@ -45,7 +45,7 @@ class TestClass:
         ({'installer_type': 'fuel',
           'installer_ip': '10.20.0.2',
           'pod_name': 'zte-pod1',
-          'max-minutes': 20,
+          'max_minutes': 20,
           'suite_name': 'compute',
           'type': 'VM'},
          {'job_id': '',
@@ -53,7 +53,7 @@ class TestClass:
           'installer_ip': '10.20.0.2',
           'pod_name': 'zte-pod1',
           'suite_name': 'compute',
-          'max-minutes': 20,
+          'max_minutes': 20,
           'type': 'VM',
           'state': 'finished',
           'state_detail': [{u'state': u'finished', u'benchmark': u'dhrystone_vm.yaml'},