Files
mtusi2026lab5/scripts/verify_cleanup.py
T

17 lines
855 B
Python

"""Explicit small retention test; shortened TTL is isolated to the test process."""
from verify import BASE,ROOT,EVIDENCE,Client,compose,command,ready,save,DC
client = Client(BASE,timeout=5)
alice,bob,eve,chat = client.bootstrap()
try:
compose('stop','-t','1','worker','publisher')
queued,data = client.attachment(alice,chat)
failed,_ = client.attachment(alice,chat)
proc = command(DC+['run','--rm','--no-deps','test-runner','python','student-tests/maintenance.py',queued['id'],failed['id']])
(EVIDENCE/'staging-retention.txt').write_text(proc.stdout,encoding='utf-8')
finally:
compose('start','publisher','worker')
_,info = ready(client,bob,queued,data)
save('retention-active-recovery.json',{'result':'PASS','job':info})
print('PASS: retention preserves active input, removes expired failed/orphan staging, recovery succeeds.')