# balancing: balancing, shared sessions/data/files, X-Instance-Id
# date: 2026-10-24 15:40:58, commit: 276dbda + uncommitted changes
# command: python.exe student-tests/test_balancing.py
# exit code: 0, 2.1 s

20 x GET /users/me with one token -> replicas: {'b9ad6d33d190': 10, '5aa14958c864': 10}
PASS: one session works on every replica, no second login (sessions are shared in Redis)
message written by 5aa14958c864; read back by ['5aa14958c864', 'b9ad6d33d190']
PASS: a message written via one replica is read right away via another (shared PostgreSQL)
logout on b9ad6d33d190; old token then rejected by ['5aa14958c864', 'b9ad6d33d190']
PASS: logout on one replica revokes the session on all of them
first POST on b9ad6d33d190 -> 201 af45ed44-ef90-4258-b144-77628e56bfed; same key on 5aa14958c864 -> 201 af45ed44-ef90-4258-b144-77628e56bfed
PASS: Idempotency-Key is shared: a retry through another replica returns the same message
file uploaded via b9ad6d33d190; downloaded byte for byte via ['5aa14958c864', 'b9ad6d33d190']
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 container ['5aa14958c864', 'b9ad6d33d190']; api containers: ['5aa14958c864', 'b9ad6d33d190']
PASS: X-Instance-Id is in every response and points to a real container
6 passed, 0 failed
