forked from mtusi2026/mtusi2026lab4
21 lines
700 B
Python
21 lines
700 B
Python
"""Isolated CLI fault: real process death after PUT, before DB ready COMMIT."""
|
|
import hashlib
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
import sys
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
|
|
from app import store, object_store
|
|
|
|
|
|
def crash(aid,key):
|
|
print(json.dumps({'id':aid,'key':key}),flush=True)
|
|
os._exit(86)
|
|
|
|
if __name__=='__main__':
|
|
store.pool.open(wait=True,timeout=15)
|
|
path=Path(__file__).resolve().parents[1]/'tests/fixtures/sample.png'
|
|
payload=path.read_bytes()
|
|
with path.open('rb') as stream:
|
|
object_store.persist(stream,sys.argv[1],sys.argv[2],'crash.png','image/png',len(payload),hashlib.sha256(payload).hexdigest(),after_put=crash)
|