#!/usr/bin/env python3 """Verify RustFS outage through the API process and recover the service.""" import subprocess, time from client import Client, arguments, run def main(): args=arguments('Lab 4 S3 dependency outage check') c=Client(args.base_url,args.ca_file); alice,bob,eve,chat=c.bootstrap() subprocess.run(['docker','compose','--env-file','.env','stop','rustfs'],check=True,stdout=subprocess.DEVNULL) try: probe=subprocess.run(['docker','compose','--env-file','.env','exec','-T','-e','LAB_TEST_TOKEN='+alice['token'],'-e','LAB_TEST_CHAT='+chat['id'],'api','python','tests/s3_failure_probe.py'],check=True,capture_output=True,text=True) print(probe.stdout.strip()) finally: subprocess.run(['docker','compose','--env-file','.env','start','rustfs'],check=True,stdout=subprocess.DEVNULL) deadline=time.monotonic()+60 while time.monotonic()