chore: support configurable Go module proxy
This commit is contained in:
@@ -11,6 +11,7 @@ import sys
|
|||||||
def main() -> None:
|
def main() -> None:
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument("--image", default="golang:1.25")
|
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("--duration", default="30m")
|
||||||
parser.add_argument("--timeout", default="35m", help="go test timeout (default: 35m)")
|
parser.add_argument("--timeout", default="35m", help="go test timeout (default: 35m)")
|
||||||
parser.add_argument("--gomaxprocs", type=int, default=2)
|
parser.add_argument("--gomaxprocs", type=int, default=2)
|
||||||
@@ -27,6 +28,10 @@ def main() -> None:
|
|||||||
"-v", f"{root}:/workspace", "-w", "/workspace",
|
"-v", f"{root}:/workspace", "-w", "/workspace",
|
||||||
"-e", "GOWORK=off", "-e", f"GOMAXPROCS={args.gomaxprocs}",
|
"-e", "GOWORK=off", "-e", f"GOMAXPROCS={args.gomaxprocs}",
|
||||||
"-e", f"GO_OMNI_HTTP2_SOAK_DURATION={args.duration}",
|
"-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",
|
args.image, "go", "test", "-race", "-timeout", args.timeout, "./transport/http2",
|
||||||
"-run", "^TestTLSSoak$", "-count=1",
|
"-run", "^TestTLSSoak$", "-count=1",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ def workspace_output(root: Path, value: str) -> tuple[Path, str]:
|
|||||||
def main() -> None:
|
def main() -> None:
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument("--image", default="golang:1.25", help="Docker image (default: golang:1.25)")
|
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("--gomaxprocs", type=int, default=4)
|
||||||
parser.add_argument("--load", action="store_true", help="also run the isolated server matrix")
|
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")
|
parser.add_argument("--tls", action="store_true", help="run the load matrix over TLS")
|
||||||
@@ -70,8 +71,10 @@ def main() -> None:
|
|||||||
"-w", "/workspace",
|
"-w", "/workspace",
|
||||||
"-e", "GOWORK=off",
|
"-e", "GOWORK=off",
|
||||||
"-e", f"GOMAXPROCS={args.gomaxprocs}",
|
"-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 image: {args.image}", flush=True)
|
||||||
print(f"Linux verification command: {command}", flush=True)
|
print(f"Linux verification command: {command}", flush=True)
|
||||||
result = subprocess.run(docker_args, cwd=root)
|
result = subprocess.run(docker_args, cwd=root)
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ def main() -> None:
|
|||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument("--image", default="golang:1.25")
|
parser.add_argument("--image", default="golang:1.25")
|
||||||
parser.add_argument("--nginx-image", default="nginx:1.27-alpine")
|
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()
|
args = parser.parse_args()
|
||||||
if shutil.which("docker") is None:
|
if shutil.which("docker") is None:
|
||||||
raise SystemExit("docker is required for proxy verification")
|
raise SystemExit("docker is required for proxy verification")
|
||||||
@@ -203,13 +204,16 @@ def main() -> None:
|
|||||||
directory = Path(temporary)
|
directory = Path(temporary)
|
||||||
edge_port = free_port()
|
edge_port = free_port()
|
||||||
write_edge_certificate(directory)
|
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(
|
backend = subprocess.Popen(
|
||||||
[
|
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",
|
|
||||||
args.image, "sh", "-c", "go run ./internal/perfcheck --server native --tls",
|
|
||||||
],
|
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
|
|||||||
Reference in New Issue
Block a user