forked from mtusi2026/mtusi2026lab5
Выполнить лабораторную 5: асинхронный pipeline и исследование идемпотентности
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
"""Check that the persistence hook actually restarted every running service."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
root=Path(__file__).resolve().parents[1]/'evidence'
|
||||
before={c['name']:c for c in json.loads((root/'persistence-before.json').read_text()) if c['status']=='running'}
|
||||
after={c['name']:c for c in json.loads((root/'persistence-after.json').read_text())}
|
||||
rows=[]
|
||||
for name,old in before.items():
|
||||
new=after[name]
|
||||
assert old['id']==new['id'],name+': container unexpectedly replaced'
|
||||
assert old['started_at']!=new['started_at'],name+': process not restarted'
|
||||
assert old['volumes']==new['volumes'],name+': volumes changed'
|
||||
assert new['status']=='running',name+': not running'
|
||||
rows.append(dict(name=name,service=new['service'],same_container=True,process_restarted=True,same_volumes=True))
|
||||
print(json.dumps({'status':'PASS','running_processes_restarted':len(rows),'rows':rows},indent=2))
|
||||
Reference in New Issue
Block a user