From 0c80a0078a6c445d27841a47024074e3f7a01446 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 30 Mar 2021 23:22:23 +0200 Subject: [PATCH] Address review feedback - fix comments, add another test case for result_size == max_result_size, clarify query parameter value represents bytes. --- st2api/tests/unit/controllers/v1/test_executions.py | 13 +++++++++++-- st2common/st2common/openapi.yaml | 2 +- st2common/st2common/openapi.yaml.j2 | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/st2api/tests/unit/controllers/v1/test_executions.py b/st2api/tests/unit/controllers/v1/test_executions.py index 114e9ee470..beb6b8a529 100644 --- a/st2api/tests/unit/controllers/v1/test_executions.py +++ b/st2api/tests/unit/controllers/v1/test_executions.py @@ -387,7 +387,7 @@ def test_get_one_max_result_size_query_parameter(self): self.assertEqual(get_resp.json["result"], data["result"]) self.assertEqual(self._get_actionexecution_id(get_resp), actionexecution_id) - # 3. ?max_result_size > actual result size - result field should not be returned + # 3. ?max_result_size < actual result size - result field should not be returned get_resp = self._do_get_one( actionexecution_id + "?max_result_size=%s" % (actual_result_size - 1) ) @@ -396,7 +396,7 @@ def test_get_one_max_result_size_query_parameter(self): self.assertTrue("result" not in get_resp.json) self.assertEqual(self._get_actionexecution_id(get_resp), actionexecution_id) - # 4. ?max_result_size > actual result size and ?include_attributes=result - result field + # 4. ?max_result_size < actual result size and ?include_attributes=result - result field # should not be returned get_resp = self._do_get_one( actionexecution_id @@ -440,6 +440,15 @@ def test_get_one_max_result_size_query_parameter(self): "max_result_size query parameter must be smaller than 14 MB", ) + # 8. ?max_result_size == actual result size - result should be returned + get_resp = self._do_get_one( + actionexecution_id + "?max_result_size=%s" % (actual_result_size) + ) + self.assertEqual(get_resp.status_int, 200) + self.assertEqual(get_resp.json["result_size"], actual_result_size) + self.assertEqual(get_resp.json["result"], data["result"]) + self.assertEqual(self._get_actionexecution_id(get_resp), actionexecution_id) + def test_get_all_id_query_param_filtering_success(self): post_resp = self._do_post(LIVE_ACTION_1) actionexecution_id = self._get_actionexecution_id(post_resp) diff --git a/st2common/st2common/openapi.yaml b/st2common/st2common/openapi.yaml index 23b70aec2b..723c6f5235 100644 --- a/st2common/st2common/openapi.yaml +++ b/st2common/st2common/openapi.yaml @@ -1098,7 +1098,7 @@ paths: - name: max_result_size in: query type: integer - description: True to exclude result field from the response for executions which result field exceeds the provided size. + description: True to exclude result field from the response for executions which result field exceeds the provided size in bytes. x-parameters: - name: user in: context diff --git a/st2common/st2common/openapi.yaml.j2 b/st2common/st2common/openapi.yaml.j2 index 94a8154ec1..b41602587b 100644 --- a/st2common/st2common/openapi.yaml.j2 +++ b/st2common/st2common/openapi.yaml.j2 @@ -1094,7 +1094,7 @@ paths: - name: max_result_size in: query type: integer - description: True to exclude result field from the response for executions which result field exceeds the provided size. + description: True to exclude result field from the response for executions which result field exceeds the provided size in bytes. x-parameters: - name: user in: context