forked from mtusi2026/mtusi2026lab4
Исправить таймаут PostgreSQL на стороне API
This commit is contained in:
+9
-1
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run acceptance checks and save real UTF-8 evidence. Requires an already running stand."""
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
@@ -16,14 +17,21 @@ def main():
|
||||
('smoke.txt', ['tests/smoke.py', '--base-url', url]),
|
||||
('tests.txt', ['-m', 'unittest', 'discover', '-s', 'student-tests', '-v']),
|
||||
('lab4-checks.txt', ['scripts/lab4_checks.py', '--base-url', url]),
|
||||
('postgres-pause.txt', ['scripts/check_postgres_pause.py', '--base-url', url]),
|
||||
('persistence.txt', ['tests/resilience.py', '--mode', 'persistence', '--action-script', hook, '--base-url', url]),
|
||||
('stack.txt', ['scripts/stack_evidence.py']),
|
||||
]
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--only', nargs='+', choices=[Path(filename).stem for filename, _ in checks])
|
||||
parser.add_argument('--output-prefix', default='', help='Keep a separate set of evidence logs')
|
||||
options = parser.parse_args()
|
||||
for filename, args in checks:
|
||||
if options.only and Path(filename).stem not in options.only:
|
||||
continue
|
||||
result = subprocess.run([sys.executable, '-X', 'utf8', *args], cwd=ROOT,
|
||||
env=dict(os.environ, BASE_URL=url), capture_output=True)
|
||||
content = result.stdout.decode('utf-8', errors='replace') + result.stderr.decode('utf-8', errors='replace')
|
||||
(ROOT / 'evidence' / filename).write_text(content, encoding='utf-8')
|
||||
(ROOT / 'evidence' / (options.output_prefix + filename)).write_text(content, encoding='utf-8')
|
||||
print(filename + ': ' + ('PASS' if result.returncode == 0 else 'FAIL'), flush=True)
|
||||
if result.returncode:
|
||||
print(content[-6000:], flush=True)
|
||||
|
||||
Reference in New Issue
Block a user