#!/usr/bin/env python3 """Black-box fault experiment. Mutates only this synthetic Compose project.""" import hashlib,json,os,subprocess,sys,time,uuid from pathlib import Path ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'tests')) from client import Client,check,Failure BASE=os.environ.get('BASE_URL','http://localhost:8086');C=Client(BASE) RESULT={'method':'real process/container faults; no forged timestamps','cases':[]} def dc(*args):return subprocess.check_output(['docker','compose',*args],cwd=ROOT,text=True,stderr=subprocess.DEVNULL).strip() def sql(query):return dc('exec','-T','postgres','psql','-U','messenger','-d','messenger','-Atc',query) def record(name,**kwargs):RESULT['cases'].append(dict(name=name,**kwargs));print('PASS:',name,flush=True) def meta(a,id):return C.call('GET','/api/v1/attachments/'+id,actor=a,schema='Attachment')['json'] def wait_status(a,id,status,timeout=130): start=time.monotonic() while time.monotonic()-start