# balancing: balancing, shared sessions/data/files, X-Instance-Id
# date: 2026-11-07 15:21:37, commit: 5bfc53a + uncommitted changes
# command: python student-tests/test_balancing.py
# exit code: 0, 2.8 s

20 x GET /users/me with one token -> replicas: {'4ec098d7198a': 10, '9b3c6b6625a9': 10}
PASS: one session works on every replica, no second login (sessions are shared in Redis)
message written by 9b3c6b6625a9; read back by ['4ec098d7198a', '9b3c6b6625a9']
PASS: a message written via one replica is read right away via another (shared PostgreSQL)
logout on 4ec098d7198a; old token then rejected by ['4ec098d7198a', '9b3c6b6625a9']
PASS: logout on one replica revokes the session on all of them
first POST on 4ec098d7198a -> 201 34d01e03-4930-4859-b912-60d58ae2bca9; same key on 9b3c6b6625a9 -> 201 34d01e03-4930-4859-b912-60d58ae2bca9
PASS: Idempotency-Key is shared: a retry through another replica returns the same message
file uploaded via 4ec098d7198a; downloaded byte for byte via ['4ec098d7198a', '9b3c6b6625a9']
PASS: a file uploaded through one replica is downloaded through another (shared S3, nothing local)
statuses [200, 200, 201, 400, 401, 404, 409]: every answer has X-Instance-Id of a running replica ['4ec098d7198a', '9b3c6b6625a9']; api containers -> aliases: {'api-1': '4ec098d7198a', 'api-2': '9b3c6b6625a9'}
PASS: X-Instance-Id is in every response and points to a real container
6 passed, 0 failed
