Skip to content

Commit 6a74ad1

Browse files
committed
test: Address review feedback on L0_http JSON size boundary test
- Rename _build_string_body_of_size -> _build_json_string_body_of_size (more specific name, JSON is the operative format) - Drop PR-specific commentary from the test docstring and inline comments; keep only documentation that's useful when reading the test itself Per review on #8819.
1 parent a3ab6d8 commit 6a74ad1

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

qa/L0_http/http_input_size_limit_test.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def test_large_input_json(self):
499499
f"Expected shape {[1, shape_size]}, got {result['outputs'][0]['shape']}",
500500
)
501501

502-
def _build_string_body_of_size(self, target_size):
502+
def _build_json_string_body_of_size(self, target_size):
503503
"""Build a JSON inference request body that is exactly target_size bytes."""
504504
payload = {
505505
"inputs": [
@@ -520,18 +520,11 @@ def _build_string_body_of_size(self, target_size):
520520
return body
521521

522522
def test_large_string_in_json(self):
523-
"""Verify the server's JSON size limit at the byte boundary.
524-
525-
Uses a body well below the INT32 Content-Length max (~2GB) so the
526-
server's JSON-size check fires deterministically rather than failing
527-
in Content-Length header parsing.
528-
"""
523+
"""Verify the server's JSON size limit at the byte boundary."""
529524
model = "simple_identity"
530525
headers = {"Content-Type": "application/json"}
531526

532-
# 1 byte over the 64 MiB default limit must be rejected with the
533-
# size-limit error.
534-
body_over = self._build_string_body_of_size(DEFAULT_LIMIT_BYTES + 1)
527+
body_over = self._build_json_string_body_of_size(DEFAULT_LIMIT_BYTES + 1)
535528
response = requests.post(
536529
self._get_infer_url(model), data=body_over, headers=headers
537530
)
@@ -547,8 +540,7 @@ def test_large_string_in_json(self):
547540
self.assertIn(" bytes exceeds the maximum allowed input size of ", error_msg)
548541
self.assertIn("Use --http-max-input-size to increase the limit.", error_msg)
549542

550-
# Exactly at the limit must pass the size check.
551-
body_at = self._build_string_body_of_size(DEFAULT_LIMIT_BYTES)
543+
body_at = self._build_json_string_body_of_size(DEFAULT_LIMIT_BYTES)
552544
response = requests.post(
553545
self._get_infer_url(model), data=body_at, headers=headers
554546
)

0 commit comments

Comments
 (0)