"""Operator lifecycle checks: rotation, revocation, sealed Bao and token expiry.""" import json,ssl,subprocess,sys,time,urllib.request,urllib.error from pathlib import Path ROOT=Path(__file__).resolve().parents[1] sys.path[:0]=[str(ROOT/'scripts'),str(ROOT/'tests')] import bao from client import Client,check c=Client('https://localhost:8443',str(ROOT/'secrets/ca/ca.crt')) a,b,_,chat=c.bootstrap();results={} def images(): names=['mtusi-lab7-'+x+'-1' for x in ('api-a','api-b','worker')] rows=json.loads(subprocess.check_output(['docker','inspect',*names],text=True)) return {r['Name']:r['Image'] for r in rows} def ready(): ctx=ssl.create_default_context(cafile=str(ROOT/'secrets/ca/ca.crt')) try: with urllib.request.urlopen('https://localhost:8443/health/ready',context=ctx,timeout=2) as response:return response.status==200 except (OSError,urllib.error.URLError):return False def wait(function,seconds=80): deadline=time.monotonic()+seconds while time.monotonic()