forked from mtusi2026/mtusi2026lab4
46 lines
2.7 KiB
Plaintext
46 lines
2.7 KiB
Plaintext
# orphans
|
|
# date: 2026-10-29T19:36:33 commit: no-git
|
|
|
|
$ docker compose --env-file .env --profile fault up -d api-fault
|
|
Container mtusi-lab4-postgres-1 Running
|
|
Container mtusi-lab4-api-fault-1 Recreate
|
|
Container mtusi-lab4-api-fault-1 Recreated
|
|
Container mtusi-lab4-postgres-1 Waiting
|
|
Container mtusi-lab4-postgres-1 Healthy
|
|
Container mtusi-lab4-api-fault-1 Starting
|
|
Container mtusi-lab4-api-fault-1 Started
|
|
[exit 0]
|
|
|
|
$ C:\Users\79152\AppData\Local\Python\pythoncore-3.14-64\python.exe student-tests/orphans.py --base-url http://localhost:8080 --fault-url http://localhost:8082
|
|
ok - fault replica (profile fault) is ready on --fault-url
|
|
ok - committed attachment that must survive every cleanup
|
|
baseline: {'objects': 35, 'attachments': 35, 'upload_intents': 0}
|
|
== 1. прерванная загрузка ==
|
|
ok - no object, no metadata, no journal row after interrupted upload ({'objects': 35, 'attachments': 35, 'upload_intents': 0})
|
|
== 2. отказ БД после PUT: немедленная компенсация ==
|
|
ok - upload answered 503, not 201 (got 503)
|
|
ok - object deleted by compensation, journal clean ({'objects': 35, 'attachments': 35, 'upload_intents': 0})
|
|
== 3. процесс убит между PUT и COMMIT ==
|
|
ok - client did NOT get 201 (got 502)
|
|
ok - orphan object + journal row left behind, no metadata ({'objects': 36, 'attachments': 35, 'upload_intents': 1})
|
|
ok - default grace 900 s: fresh upload is NOT touched
|
|
ok - dry-run reports 1 object, changes nothing
|
|
ok - janitor removed orphan + journal row ({'grace_seconds': 5, 'dry_run': False, 'locked': True, 'intents_expired': 1, 'intents_removed': 1, 'objects_deleted': 1, 'would_delete_objects': 0, 'orphans_found': 0, 'errors': 0, 'duration_ms': 33.0})
|
|
ok - second run is a no-op (idempotent)
|
|
== 4. объект без журнала (страховочный обход bucket) ==
|
|
ok - untracked object planted
|
|
ok - scan with grace 1 h ignores a fresh object
|
|
ok - scan dry-run finds 1
|
|
ok - scan deletes the untracked object ({'grace_seconds': 5, 'dry_run': False, 'locked': True, 'intents_expired': 0, 'intents_removed': 0, 'objects_deleted': 1, 'would_delete_objects': 0, 'orphans_found': 1, 'errors': 0, 'objects_scanned': 36, 'duration_ms': 86.7})
|
|
== 5. готовые вложения не тронуты ==
|
|
ok - committed attachment still downloads, sha256 matches
|
|
ok - object + metadata, no journal row ({'object_exists': True, 'attachment_row': True, 'upload_intent': False})
|
|
|
|
17 passed, 0 failed
|
|
[exit 0]
|
|
|
|
$ docker compose --env-file .env --profile fault stop api-fault
|
|
Container mtusi-lab4-api-fault-1 Stopping
|
|
Container mtusi-lab4-api-fault-1 Stopped
|
|
[exit 0]
|