Implement lab 2 PostgreSQL persistence and expiring sessions

This commit is contained in:
Горбанюк
2026-10-17 17:43:08 +03:00
parent b65738733c
commit c070b4babc
40 changed files with 7016 additions and 22 deletions
+4
View File
@@ -0,0 +1,4 @@
.venv/bin/python scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
.venv/bin/python scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
+22
View File
@@ -0,0 +1,22 @@
{
"docker": "29.8.1",
"vm_cpus": 18,
"vm_memory_bytes": 8317267968,
"cpu_model": "Apple M5 Pro",
"host_memory_bytes": 25769803776,
"runtime_source_matches": true,
"python_source_sha256": {
"auth.py": "6bebcd8d1d3ca4c2c6e8b0e5793ae13d8996cac3709b5b845d814b51a5e1a3c3",
"service.py": "d395dac6864c6ee6df6e1f30e3fa24a00cb29bdadfbdd1bdbc2d34c791e2a2c4",
"domain.py": "e970ab21fb0ada53dce3520563ef891c28710957dabf6bcff063449516ebb425",
"cache.py": "17756fa84a2c40fd4d1baf9602a7b755ca5998bc241f0657db3505b04623321d",
"__init__.py": "f798dc149d6bef46d697dccdaf6be9c8d08654f18161e42c99f548c30074f4ae",
"schemas.py": "e0254f10b3f64f38525f22824548f935723a1ea895ee8cf7c2be0b5d3b80c5b1",
"settings.py": "c6c9f8dec27b94c76f7e9e4c2be2b1b4b053521dea2edd5eacb312b766722e72",
"app.py": "ee214a538b2dfe5083f07400dfe73423877b9d2019213fc91f00a57017368175",
"repository.py": "0232b73d77d5ab551090f14eb5709cac422aa1a97f32a75241bca369f8ddf21c",
"migrate.py": "f073c080e13635a01482539dbb474b9b4f49bbf5ff66f483dbda4fbe1d1eb57f",
"__main__.py": "486cd5bbb3f1a814de74357e938968d219070e845cf178761a7a23e87d003ea4",
"cursor.py": "a2208cba232ae0f67c4430d3e90c3962129c8fb3987ea853c624cdd2c73d7a1f"
}
}
+79
View File
@@ -0,0 +1,79 @@
{
"at": "2026-10-17T14:34:34.316178+00:00",
"before_restart": {
"api": {
"id": "b608ad8e989d9dbdf1cd57d9eb72c4a51641dd4a4a8a57664413e696802c7eca",
"started_at": "2026-10-17T14:31:11.185486549Z",
"pid": 11744,
"image": "sha256:320b3b425ce160820a3cda448d2a080f00abad7e84eb47dff68a4ca1e05748fb",
"memory_limit": 536870912,
"nano_cpus": 1000000000
},
"postgres": {
"id": "3e23e8c2f67821a47170c4eefdca1f1cb9924943d66e8e00e5f6f9bb68003a47",
"started_at": "2026-10-17T14:31:08.021070173Z",
"pid": 11535,
"image": "sha256:7e32e9833a6fb1c92c32552794cb6ed569d51b445a54907d35fc112ef39684db",
"memory_limit": 536870912,
"nano_cpus": 1000000000
},
"valkey": {
"id": "c3a46b5456d9fe3af9c4cab15ef5524dcd221b756d8b66a446b9828796644645",
"started_at": "2026-10-17T14:31:07.934909464Z",
"pid": 11460,
"image": "sha256:d827e7f7552cdee40cc7482dbae9da020f42bc47669af6f71182a4ef76a22773",
"memory_limit": 134217728,
"nano_cpus": 500000000
}
},
"after_restart": {
"api": {
"id": "b608ad8e989d9dbdf1cd57d9eb72c4a51641dd4a4a8a57664413e696802c7eca",
"started_at": "2026-10-17T14:34:31.776726503Z",
"pid": 18302,
"image": "sha256:320b3b425ce160820a3cda448d2a080f00abad7e84eb47dff68a4ca1e05748fb",
"memory_limit": 536870912,
"nano_cpus": 1000000000
},
"postgres": {
"id": "3e23e8c2f67821a47170c4eefdca1f1cb9924943d66e8e00e5f6f9bb68003a47",
"started_at": "2026-10-17T14:34:31.623388544Z",
"pid": 18098,
"image": "sha256:7e32e9833a6fb1c92c32552794cb6ed569d51b445a54907d35fc112ef39684db",
"memory_limit": 536870912,
"nano_cpus": 1000000000
},
"valkey": {
"id": "c3a46b5456d9fe3af9c4cab15ef5524dcd221b756d8b66a446b9828796644645",
"started_at": "2026-10-17T14:34:31.662652628Z",
"pid": 18166,
"image": "sha256:d827e7f7552cdee40cc7482dbae9da020f42bc47669af6f71182a4ef76a22773",
"memory_limit": 134217728,
"nano_cpus": 500000000
}
},
"concurrent_clients": 10,
"unique_messages": 100,
"faults": [
{
"dependency": "valkey",
"valid_session_status": 200,
"anonymous_status": 401,
"revoked_status": 401,
"fallback_seconds": 0.25391316600007485
},
{
"dependency": "postgres",
"liveness": 200,
"readiness": 503,
"cached_session_status": 503,
"anonymous_status": 401,
"request_seconds": 1.0061383330003082,
"readiness_seconds": 1.0079494999999952
}
],
"secrets_absent_from_api_logs": true,
"migration_repeat_ok": true,
"api_uid": 10001,
"history_preserved": true
}
+1
View File
@@ -0,0 +1 @@
PASS: full restart, concurrent writes, dependency failures, cache flush and revocation
+2
View File
@@ -0,0 +1,2 @@
uv run --locked ruff check src student-tests scripts/bootstrap.py scripts/verify_lifecycle.py research
All checks passed!
+3
View File
@@ -0,0 +1,3 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:8082"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
File diff suppressed because it is too large Load Diff
+8
View File
@@ -0,0 +1,8 @@
Applied migration 001_initial
Completed single repeat 1
Completed composite repeat 1
Completed composite repeat 2
Completed single repeat 2
Completed single repeat 3
Completed composite repeat 3
PASS: index comparison and backup restore verified
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://127.0.0.1:8082"
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
+2
View File
@@ -0,0 +1,2 @@
.................................... [100%]
36 passed, 1 warning in 6.10s