Skip to content

Commit 0c80a00

Browse files
committed
Address review feedback - fix comments, add another test case for
result_size == max_result_size, clarify query parameter value represents bytes.
1 parent dc0a1fb commit 0c80a00

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

st2api/tests/unit/controllers/v1/test_executions.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def test_get_one_max_result_size_query_parameter(self):
387387
self.assertEqual(get_resp.json["result"], data["result"])
388388
self.assertEqual(self._get_actionexecution_id(get_resp), actionexecution_id)
389389

390-
# 3. ?max_result_size > actual result size - result field should not be returned
390+
# 3. ?max_result_size < actual result size - result field should not be returned
391391
get_resp = self._do_get_one(
392392
actionexecution_id + "?max_result_size=%s" % (actual_result_size - 1)
393393
)
@@ -396,7 +396,7 @@ def test_get_one_max_result_size_query_parameter(self):
396396
self.assertTrue("result" not in get_resp.json)
397397
self.assertEqual(self._get_actionexecution_id(get_resp), actionexecution_id)
398398

399-
# 4. ?max_result_size > actual result size and ?include_attributes=result - result field
399+
# 4. ?max_result_size < actual result size and ?include_attributes=result - result field
400400
# should not be returned
401401
get_resp = self._do_get_one(
402402
actionexecution_id
@@ -440,6 +440,15 @@ def test_get_one_max_result_size_query_parameter(self):
440440
"max_result_size query parameter must be smaller than 14 MB",
441441
)
442442

443+
# 8. ?max_result_size == actual result size - result should be returned
444+
get_resp = self._do_get_one(
445+
actionexecution_id + "?max_result_size=%s" % (actual_result_size)
446+
)
447+
self.assertEqual(get_resp.status_int, 200)
448+
self.assertEqual(get_resp.json["result_size"], actual_result_size)
449+
self.assertEqual(get_resp.json["result"], data["result"])
450+
self.assertEqual(self._get_actionexecution_id(get_resp), actionexecution_id)
451+
443452
def test_get_all_id_query_param_filtering_success(self):
444453
post_resp = self._do_post(LIVE_ACTION_1)
445454
actionexecution_id = self._get_actionexecution_id(post_resp)

st2common/st2common/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ paths:
10981098
- name: max_result_size
10991099
in: query
11001100
type: integer
1101-
description: True to exclude result field from the response for executions which result field exceeds the provided size.
1101+
description: True to exclude result field from the response for executions which result field exceeds the provided size in bytes.
11021102
x-parameters:
11031103
- name: user
11041104
in: context

st2common/st2common/openapi.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ paths:
10941094
- name: max_result_size
10951095
in: query
10961096
type: integer
1097-
description: True to exclude result field from the response for executions which result field exceeds the provided size.
1097+
description: True to exclude result field from the response for executions which result field exceeds the provided size in bytes.
10981098
x-parameters:
10991099
- name: user
11001100
in: context

0 commit comments

Comments
 (0)