ЛР 4 — вложения S3 и reconciler

This commit is contained in:
2026-11-15 01:40:45 +03:00
parent ec540a1a72
commit 007da711ba
30 changed files with 1250 additions and 80 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/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()<deadline:
try:
c.call('GET','/health/ready',200)
print('PASS: readiness returned 200 after RustFS restart')
return
except AssertionError:
time.sleep(1)
raise AssertionError('health did not recover after RustFS restart')
if __name__=='__main__': run(main)