forked from mtusi2026/mtusi2026lab3
ЛР 3 — БПИ2302 — Щербацевич — на 5
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Публичный persistence-сценарий с restart.cmd на Windows и restart.sh на POSIX."""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def script():
|
||||
if os.name == "nt":
|
||||
cmd = ROOT / "scripts" / "restart.cmd"
|
||||
if cmd.is_file():
|
||||
return str(cmd)
|
||||
return str(ROOT / "scripts" / "restart.sh")
|
||||
|
||||
|
||||
def main():
|
||||
env = os.environ.copy()
|
||||
command = [
|
||||
sys.executable,
|
||||
str(ROOT / "tests" / "resilience.py"),
|
||||
"--mode",
|
||||
"persistence",
|
||||
"--action-script",
|
||||
script(),
|
||||
"--base-url",
|
||||
env.get("BASE_URL", "http://127.0.0.1:8080"),
|
||||
]
|
||||
completed = subprocess.run(command, cwd=str(ROOT), env=env)
|
||||
raise SystemExit(completed.returncode)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user