forked from mtusi2026/mtusi2026lab3
ЛР3 БВТ2304 Запорожец на 4
HAProxy + 2 API-реплики, общие PostgreSQL/Valkey, обязательный Idempotency-Key, graceful drain по SIGTERM, stop-one/restart/rolling-update, серии отказов и REPORT.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Один вход (одна сессия) -> 10 запросов через LB: какие реплики обслужили. Токен не печатается."""
|
||||
import os
|
||||
import sys
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tests'))
|
||||
from client import Client # noqa: E402
|
||||
|
||||
c = Client(os.environ.get('BASE_URL', 'http://lb:8080'))
|
||||
alice = c.user('instances')
|
||||
served = [c.call('GET', '/api/v1/users/me', actor=alice, schema='User')['headers']['X-Instance-Id'] for _ in range(10)]
|
||||
print('X-Instance-Id sequence:', ' '.join(served))
|
||||
print('distinct replicas for one session without re-login:', dict(Counter(served)))
|
||||
Reference in New Issue
Block a user