ЛР 2: PostgreSQL, сессии, Valkey и исследование восстановления

This commit is contained in:
2026-10-30 21:03:37 +03:00
parent 65003b6119
commit 5b47c579cc
18 changed files with 1330 additions and 32 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
"""Run only with SESSION_TTL_SECONDS=2 in the Compose environment."""
import time
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests"))
from client import Client, Failure, arguments, check, run
def main():
args=arguments("Check persisted session expiry with a short TTL")
c=Client(args.base_url,args.ca_file)
actor=c.user("ttl")
c.call("GET","/api/v1/users/me",200,actor=actor,schema="User")
time.sleep(2.2)
c.call("GET","/api/v1/users/me",401,actor=actor)
print("PASS: session expired at the configured two-second TTL")
if __name__=="__main__": run(main)