forked from mtusi2026/mtusi2026lab3
23 lines
1.6 KiB
Plaintext
23 lines
1.6 KiB
Plaintext
# idempotency: Idempotency-Key, parallel same key via replicas
|
|
# date: 2026-10-14 20:24:15, commit: 0ab3a34 + uncommitted changes
|
|
# command: python.exe student-tests/test_idempotency.py
|
|
# exit code: 0, 2.3 s
|
|
|
|
first -> 201; same JSON written differently -> 201; plain retry -> 201
|
|
PASS: a retry with the same key returns the original 201 and message, no duplicate
|
|
20 parallel POSTs with one key: statuses {201: 20}, replicas {'58542a53644c': 10, '9737b915ff2f': 10}, different bodies in answers: 1, messages in history: 1
|
|
PASS: parallel requests with one key through different replicas create exactly one message
|
|
20 parallel POSTs, one key, two different bodies: {('body A', 409): 10, ('body B', 201): 10}; saved: ['body B']
|
|
PASS: the first body wins, the same body gets 201, the other body gets 409
|
|
one key: alice in chat 1, bob in chat 1, alice in chat 2 -> 3 messages
|
|
PASS: the key is scoped to the current user and chat; another body with a used key -> 409
|
|
missing, empty, 129 chars, space, '/', non-ASCII, '"', '+' -> 400; 128 chars of A-Z a-z 0-9 . _ : - -> 201
|
|
PASS: Idempotency-Key is required and checked: [A-Za-z0-9._:-]{1,128}
|
|
key used by a 400 and by a 404 first, then valid request -> 201
|
|
PASS: rejected requests (400, 404) do not store a result for the key
|
|
same key and body by an outsider -> 404; by alice after logout -> 401
|
|
PASS: a retry checks the session and chat access again, the saved answer is not leaked
|
|
POST sent, connection closed without reading the answer; retry -> 201; messages: 1
|
|
PASS: an unconfirmed POST can be safely retried with the same key
|
|
8 passed, 0 failed
|