forked from mtusi2026/mtusi2026lab4
Check upload faults and user errors against the stand
test_attachment_faults.py runs through the balancer against the real PostgreSQL and RustFS. The negative suite sends a body one byte over the limit with Content-Length (answered before any body byte) and chunked, a decompression bomb, truncated and disguised images, missing and foreign content types, dangerous names, a stranger's reads and references, an attachment of another chat and invalid lists, checks each code and error body, and finds no 5xx in the replica logs and no extra rows. Faults come from triggers installed for the module and dropped after it: an AFTER INSERT trigger remembers the id and key of each fault intent, a BEFORE UPDATE trigger rejects the ready commit for fault-fail names and holds it for 1.8 s for fault-crash names, while the test finds the waiting backend's client address and kills that replica with SIGKILL. The rejected commit leaves neither row nor object right away and an audit line says compensation; a crash leaves a pending row and an object, the one aged past the grace period is swept with its object while the fresh one stays, and an aged ready attachment in a message still downloads. A body cut after 256 KiB is logged as 400 with nothing written, and a stalled body gets 503 after 8 s with nothing written. make upload-faults stores the output in evidence/upload-faults.txt without tracebacks of locals, and the CI acceptance job runs it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
28055a8551
commit
98df351235
@@ -19,7 +19,7 @@ PSQL = $(COMPOSE) exec -T postgres psql -U messenger -d messenger -X -q
|
||||
secrets up down reset-data migrate ps logs restore lb-check failover-evidence stack-evidence \
|
||||
persistence-evidence storage-evidence cache-evidence test-faults seed explain \
|
||||
limits detection failover-each rolling-update level4 \
|
||||
scenario s3-check attachments-evidence
|
||||
scenario s3-check attachments-evidence upload-faults
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@@ -28,6 +28,7 @@ help:
|
||||
@echo "restore: вернуть остановленные реплики; lb-check: реплики на одном токене и 20 гонок одного ключа"
|
||||
@echo "level4 = limits, lb-check, detection, failover-each, rolling-update [FROM_REV=<коммит>]; RATE=$(RATE) rps"
|
||||
@echo "scenario SCENARIO=failover-upload|s3-outage → evidence/<сценарий>.json; s3-check; attachments-evidence"
|
||||
@echo "upload-faults: негативный suite, компенсация, уборка, обрыв и зависание загрузки против стенда"
|
||||
|
||||
check:
|
||||
$(PYTHON) scripts/check_contract.py
|
||||
@@ -127,6 +128,11 @@ s3-check:
|
||||
attachments-evidence:
|
||||
sh scripts/evidence-attachments.sh
|
||||
|
||||
upload-faults:
|
||||
BASE_URL="$(BASE_URL)" $(VENV)/bin/pytest -m stack -v -s --no-header --tb=short -p no:cacheprovider \
|
||||
student-tests/stack/test_attachment_faults.py > evidence/upload-faults.txt; \
|
||||
status=$$?; cat evidence/upload-faults.txt; exit $$status
|
||||
|
||||
failover-evidence:
|
||||
sh scripts/failover-evidence.sh "$(BASE_URL)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user