43 lines
1.7 KiB
Python
43 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Run checks sequentially and save UTF-8 evidence on Windows/Linux.
|
|
|
|
Start Compose first. --incidents also stops/restores worker, DB and telemetry
|
|
backends. Run only against the local synthetic stand, without concurrent tests.
|
|
"""
|
|
import argparse
|
|
import os
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
from test_lab5 import ROOT, run, snapshot, tester
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--incidents", action="store_true")
|
|
args = parser.parse_args()
|
|
os.chdir(ROOT)
|
|
for stream in (sys.stdout, sys.stderr):
|
|
if hasattr(stream, "reconfigure"):
|
|
stream.reconfigure(encoding="utf-8", errors="replace")
|
|
run(["docker", "compose", "config", "--quiet"], "compose-validation.txt")
|
|
run([sys.executable, "-X", "utf8", "scripts/check_contract.py"], "check.txt")
|
|
run(tester("make", "check", "test"), "make-check-test.txt")
|
|
run(["docker", "compose", "exec", "-T", "api", "python", "-"], "observability-unit.txt",
|
|
stdin_file=ROOT / "student-tests/observability_unit.py")
|
|
run([sys.executable, "-X", "utf8", "scripts/observe_lab6.py", "--baseline"], "observability-baseline.txt")
|
|
if args.incidents:
|
|
snapshot("Before lab6 incidents", append=False)
|
|
try:
|
|
run([sys.executable, "-X", "utf8", "scripts/observe_lab6.py", "--chain-with-retry"],
|
|
"observability-retry.txt")
|
|
run([sys.executable, "-X", "utf8", "scripts/observe_lab6.py", "--incidents"],
|
|
"observability-incidents.txt")
|
|
finally:
|
|
snapshot("After lab6 incidents")
|
|
print("PASS: lab6 checks; see evidence/.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|