42 lines
1.5 KiB
Python
Executable File
42 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Run the opt-in HTTP/2 TLS soak in a pinned Linux Go image."""
|
|
|
|
import argparse
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--image", default="golang:1.25")
|
|
parser.add_argument("--duration", default="30m")
|
|
parser.add_argument("--gomaxprocs", type=int, default=2)
|
|
args = parser.parse_args()
|
|
if not args.duration or args.gomaxprocs < 1:
|
|
parser.error("--duration must be non-empty and --gomaxprocs must be positive")
|
|
|
|
docker = shutil.which("docker")
|
|
if docker is None:
|
|
raise SystemExit("docker is required for HTTP/2 Linux soak")
|
|
root = Path(__file__).resolve().parent.parent
|
|
command = [
|
|
docker, "run", "--rm", "--pull=missing",
|
|
"-v", f"{root}:/workspace", "-w", "/workspace",
|
|
"-e", "GOWORK=off", "-e", f"GOMAXPROCS={args.gomaxprocs}",
|
|
"-e", f"GO_OMNI_HTTP2_SOAK_DURATION={args.duration}",
|
|
args.image, "go", "test", "-race", "./transport/http2",
|
|
"-run", "^TestTLSSoak$", "-count=1",
|
|
]
|
|
print(f"HTTP/2 Linux soak image: {args.image}", flush=True)
|
|
print(f"HTTP/2 TLS soak duration: {args.duration}", flush=True)
|
|
result = subprocess.run(command, cwd=root)
|
|
if result.returncode != 0:
|
|
raise SystemExit(f"HTTP/2 Linux soak failed with exit code {result.returncode}")
|
|
print("PASS HTTP/2 TLS soak", flush=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|