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

@@ -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,