ЛР4: S3-вложения (SeaweedFS), приватный bucket, компенсация/reconciler, тесты, отчёт

This commit is contained in:
2026-11-06 17:11:20 +03:00
parent ec540a1a72
commit b25600adcc
62 changed files with 4196 additions and 19 deletions
+34
View File
@@ -0,0 +1,34 @@
"""Lab3 revocation: logout takes effect immediately on every replica.
Session validity is decided only by PostgreSQL, so a revoked token must be
rejected regardless of which replica answers and regardless of the cache state.
The heavier Valkey-outage reproduction lives in scripts/check-revocation.py.
"""
from __future__ import annotations
import os
def _actor(client, label="revoke"):
suffix = os.urandom(4).hex()
username = f"s_{label}_{suffix}"
password = "T3st-" + os.urandom(8).hex()
assert client.register(username, password).status == 201
token = client.login(username, password).json["token"]
return {"id": client.me(token).json["id"], "token": token}
def test_logout_invalidates_across_replicas(client):
actor = _actor(client)
seen = set()
for _ in range(20):
response = client.me(actor["token"])
assert response.status == 200, response.body
seen.add(response.instance_id)
assert len(seen) >= 2, f"expected the LB to spread requests, saw {sorted(seen)}"
logout = client.logout(actor["token"])
assert logout.status == 204, logout.body
for _ in range(20):
assert client.me(actor["token"]).status == 401