Подтвердить трек 2 реальными сбоями, нагрузкой и отчётом
This commit is contained in:
@@ -30,27 +30,30 @@ def main():
|
||||
(directory / 'repro-override.json').write_text(json.dumps(override), encoding='utf-8')
|
||||
compose = ['docker', 'compose', '-p', name, '-f', 'compose.yaml', '-f', 'repro-override.json']
|
||||
events = []
|
||||
def run(args):
|
||||
def run(args, required=True):
|
||||
result = subprocess.run(args, cwd=directory, env=env, text=True, encoding='utf-8', capture_output=True)
|
||||
# Только безопасные последние строки: ни inspect .Config.Env, ни secret files.
|
||||
events.append(dict(command=args, exit_code=result.returncode, output=(result.stdout + result.stderr)[-5000:]))
|
||||
if result.returncode:
|
||||
if result.returncode and required:
|
||||
raise RuntimeError('reproduction failed: ' + ' '.join(args))
|
||||
try:
|
||||
run([sys.executable, '-X', 'utf8', 'scripts/bootstrap.py'])
|
||||
run([sys.executable, '-X', 'utf8', 'scripts/check_contract.py'])
|
||||
run(['docker', 'build', '-t', images[0], '.'])
|
||||
run(['docker', 'build', '-t', images[1], '-f', 'Dockerfile.s3', '.'])
|
||||
run([*compose, 'up', '-d', '--wait'])
|
||||
run([*compose, 'up', '-d'])
|
||||
run([sys.executable, '-X', 'utf8', 'scripts/wait_ready.py', '--project', name, '--base-url', f'http://127.0.0.1:{port}'])
|
||||
run([sys.executable, '-X', 'utf8', 'tests/smoke.py', '--base-url', f'http://127.0.0.1:{port}'])
|
||||
run([*compose, 'ps'])
|
||||
finally:
|
||||
run([*compose, 'down', '--volumes', '--remove-orphans'])
|
||||
run([*compose, 'down', '--volumes', '--remove-orphans'], required=False)
|
||||
for tag in images:
|
||||
run(['docker', 'image', 'rm', tag])
|
||||
run(['docker', 'image', 'rm', tag], required=False)
|
||||
result = dict(project=name, directory=str(directory), port=port,
|
||||
commit=subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=ROOT, text=True).strip(), events=events)
|
||||
(ROOT / 'evidence/reproduction.json').write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding='utf-8')
|
||||
if any(event['exit_code'] for event in events):
|
||||
raise SystemExit('Reproduction or cleanup failed; see evidence/reproduction.json')
|
||||
print('PASS: clean export, fresh secrets, isolated project; temporary Docker resources removed')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user