forked from mtusi2026/mtusi2026lab3
Разбить API на модули и перевести комментарии на русский
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Same Idempotency-Key sent N times in parallel through the LB (so through different replicas).
|
||||
Half of the requests carry body A, half body B: exactly one message must exist, every 201 must return it,
|
||||
the other body must get 409. Usage: python3 student-tests/idempotency_race.py --base-url http://localhost:8080"""
|
||||
"""Один Idempotency-Key, N параллельных запросов через LB (то есть через разные реплики).
|
||||
Половина запросов с телом A, половина с телом B: должно появиться ровно одно сообщение, каждый 201 возвращает его,
|
||||
другое тело получает 409. Запуск: python3 student-tests/idempotency_race.py --base-url http://localhost:8080"""
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -47,7 +47,7 @@ def main():
|
||||
history = c.call('GET', path + '?limit=100', actor=bob, schema='MessagePage')['json']['items']
|
||||
stored = [m for m in history if key in m['text']]
|
||||
check(stored == [winner], 'expected exactly one stored message equal to the replayed one')
|
||||
# Same key is independent for another user.
|
||||
# Тот же ключ у другого пользователя независим.
|
||||
other = c.message(bob, chat, texts[0], key=key)['json']
|
||||
check(other['id'] != winner['id'] and other['sender_id'] == bob['id'], 'key scope leaked across users')
|
||||
print(json.dumps({'parallel': args.parallel, 'replicas_hit': len(instances), 'created_201': len(created),
|
||||
|
||||
Reference in New Issue
Block a user