test: the pending-upload burst waits for the gateway's bucket to refill (CI run 393)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 7m10s
Build and deploy / Secret scan and release gate (push) Successful in 4s
Build and deploy / Publish images (push) Successful in 53s

nginx allows 20 r/s with a burst of 100; after the upload starts before
it, a fast runner met nginx's 429 instead of the API's Retry-After 15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-30 11:32:26 -03:00
parent 857eea3379
commit aeb43500a7

View File

@@ -7,6 +7,7 @@ Run against the local stack: python -m tests.upload_limits_test
import json import json
import os import os
import secrets import secrets
import time
from pathlib import Path from pathlib import Path
from urllib.error import HTTPError from urllib.error import HTTPError
from urllib.request import Request from urllib.request import Request
@@ -68,6 +69,10 @@ def run():
# DTF-WEB-3: a burst above MAX_PENDING_UPLOADS (now 30). The 31st start # DTF-WEB-3: a burst above MAX_PENDING_UPLOADS (now 30). The 31st start
# answers 429 with Retry-After 15, so the Site waits and retries alone. # answers 429 with Retry-After 15, so the Site waits and retries alone.
assert int(os.environ.get('MAX_PENDING_UPLOADS', '30')) == 30 assert int(os.environ.get('MAX_PENDING_UPLOADS', '30')) == 30
# The gateway allows 20 requests a second with a burst of 100
# (infra/nginx.conf.template): after the starts above, a fast runner
# meets nginx's 429 before the API's (CI run 393). Let it refill.
time.sleep(6)
pending = [] pending = []
for index in range(30): for index in range(30):
pending.append(client.call('/uploads', {'name': f'PENDING-{index}.png', 'size': 1})['id']) pending.append(client.call('/uploads', {'name': f'PENDING-{index}.png', 'size': 1})['id'])