forked from mtusi2026/mtusi2026lab7
lab 7
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Public failover plus explicit coverage of both distinct API replicas."""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from securitylib import ROOT, compose
|
||||
|
||||
(ROOT / "evidence/failover-events.jsonl").write_text("")
|
||||
logs = []
|
||||
try:
|
||||
for command in [
|
||||
[
|
||||
sys.executable,
|
||||
"tests/resilience.py",
|
||||
"--mode",
|
||||
"failover",
|
||||
"--action-script",
|
||||
"scripts/stop-one.sh",
|
||||
"--base-url",
|
||||
"https://localhost:8443",
|
||||
"--ca-file",
|
||||
str(ROOT / ".local/trust/ca.crt"),
|
||||
],
|
||||
[sys.executable, "tests/lab7_failovers.py"],
|
||||
]:
|
||||
result = subprocess.run(
|
||||
command, cwd=ROOT, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
)
|
||||
logs.append(result.stdout)
|
||||
print(result.stdout, end="", flush=True)
|
||||
assert result.returncode == 0, "Failover verification failed"
|
||||
compose("start", "api")
|
||||
compose("up", "-d", "--no-recreate", "--wait", "api")
|
||||
(ROOT / "evidence/failover-checks.txt").write_text("\n".join(logs))
|
||||
finally:
|
||||
compose("start", "api")
|
||||
Reference in New Issue
Block a user