chore: support configurable Go module proxy

This commit is contained in:
2026-09-23 00:47:19 +08:00
parent 15825f0ab8
commit 2b93545507
3 changed files with 19 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ import sys
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--image", default="golang:1.25")
parser.add_argument("--goproxy", default="", help="optional Go module proxy passed to the container")
parser.add_argument("--duration", default="30m")
parser.add_argument("--timeout", default="35m", help="go test timeout (default: 35m)")
parser.add_argument("--gomaxprocs", type=int, default=2)
@@ -27,6 +28,10 @@ def main() -> None:
"-v", f"{root}:/workspace", "-w", "/workspace",
"-e", "GOWORK=off", "-e", f"GOMAXPROCS={args.gomaxprocs}",
"-e", f"GO_OMNI_HTTP2_SOAK_DURATION={args.duration}",
]
if args.goproxy:
command += ["-e", f"GOPROXY={args.goproxy}"]
command += [
args.image, "go", "test", "-race", "-timeout", args.timeout, "./transport/http2",
"-run", "^TestTLSSoak$", "-count=1",
]

View File

@@ -24,6 +24,7 @@ def workspace_output(root: Path, value: str) -> tuple[Path, str]:
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--image", default="golang:1.25", help="Docker image (default: golang:1.25)")
parser.add_argument("--goproxy", default="", help="optional Go module proxy passed to the container")
parser.add_argument("--gomaxprocs", type=int, default=4)
parser.add_argument("--load", action="store_true", help="also run the isolated server matrix")
parser.add_argument("--tls", action="store_true", help="run the load matrix over TLS")
@@ -70,8 +71,10 @@ def main() -> None:
"-w", "/workspace",
"-e", "GOWORK=off",
"-e", f"GOMAXPROCS={args.gomaxprocs}",
args.image, "sh", "-c", command,
]
if args.goproxy:
docker_args += ["-e", f"GOPROXY={args.goproxy}"]
docker_args += [args.image, "sh", "-c", command]
print(f"Linux verification image: {args.image}", flush=True)
print(f"Linux verification command: {command}", flush=True)
result = subprocess.run(docker_args, cwd=root)

View File

@@ -184,6 +184,7 @@ def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--image", default="golang:1.25")
parser.add_argument("--nginx-image", default="nginx:1.27-alpine")
parser.add_argument("--goproxy", default="", help="optional Go module proxy passed to the backend container")
args = parser.parse_args()
if shutil.which("docker") is None:
raise SystemExit("docker is required for proxy verification")
@@ -203,13 +204,16 @@ def main() -> None:
directory = Path(temporary)
edge_port = free_port()
write_edge_certificate(directory)
backend_command = [
"docker", "run", "--rm", "-i", "--pull=missing", "--name", backend_name,
"--network", "host", "--cpus=1", "--memory=512m", "--pids-limit=512",
"-v", f"{root}:/workspace", "-w", "/workspace", "-e", "GOWORK=off",
]
if args.goproxy:
backend_command += ["-e", f"GOPROXY={args.goproxy}"]
backend_command += [args.image, "sh", "-c", "go run ./internal/perfcheck --server native --tls"]
backend = subprocess.Popen(
[
"docker", "run", "--rm", "-i", "--pull=missing", "--name", backend_name,
"--network", "host", "--cpus=1", "--memory=512m", "--pids-limit=512",
"-v", f"{root}:/workspace", "-w", "/workspace", "-e", "GOWORK=off",
args.image, "sh", "-c", "go run ./internal/perfcheck --server native --tls",
],
backend_command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,