forked from mtusi2026/mtusi2026lab4
Проверить ЛР4: сборка MinIO из исходников и результаты полного прогона
This commit is contained in:
+9
-2
@@ -1,5 +1,6 @@
|
||||
"""Run all checks and save actual outputs. Stop on the first failure."""
|
||||
import os
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -10,8 +11,13 @@ os.environ.setdefault('BASE_URL','http://localhost:8084')
|
||||
|
||||
def run(name, args, stdin=None):
|
||||
result=subprocess.run(args,input=stdin,text=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
|
||||
(root/'evidence'/name).write_text(result.stdout)
|
||||
print(result.stdout,end='')
|
||||
output = result.stdout
|
||||
if name.startswith('containers-') and result.returncode == 0:
|
||||
fields = ('Service', 'ID', 'Image', 'State', 'Health', 'Status', 'Ports')
|
||||
output = '\n'.join(json.dumps({key: row.get(key) for key in fields})
|
||||
for row in map(json.loads, output.splitlines())) + '\n'
|
||||
(root/'evidence'/name).write_text(output)
|
||||
print(output,end='')
|
||||
if result.returncode:
|
||||
raise SystemExit(result.returncode)
|
||||
|
||||
@@ -36,5 +42,6 @@ finally:
|
||||
subprocess.run(['docker','compose','start','api1','api2'],check=True)
|
||||
# Compose waits for the API's actual readiness after restoring the replica.
|
||||
subprocess.run(['docker','compose','up','-d','--wait','api1','api2'],check=True)
|
||||
run('attachment-failover.txt',[sys.executable,'student-tests/attachment_failover.py'])
|
||||
run('memory.txt',[sys.executable,'student-tests/memory.py'])
|
||||
print('All requested checks passed; actual results are in evidence/.')
|
||||
|
||||
Reference in New Issue
Block a user