fix: keep proxy verifier control stdin

This commit is contained in:
2026-09-22 17:35:51 +08:00
parent 4f97aa0f3d
commit 35b7470be2

View File

@@ -180,7 +180,7 @@ def main() -> None:
write_edge_certificate(directory)
backend = subprocess.Popen(
[
"docker", "run", "--rm", "--pull=missing", "--name", backend_name,
"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",
@@ -233,21 +233,8 @@ def main() -> None:
) from error
verify_keep_alive(edge_port)
verify_timeout(edge_port)
# The upstream /slow handler intentionally runs for two seconds.
# Nginx has already returned 504, but it may keep the upstream
# socket around while native drains that request. Let it finish
# before checking a clean listener shutdown.
time.sleep(2.2)
print("PASS Nginx TLS proxy, Keep-Alive and upstream timeout", flush=True)
# Drain the edge proxy before stopping its upstream, matching a
# rolling deployment where traffic is removed from the old task
# before its listener is shut down.
nginx.terminate()
nginx.wait(timeout=5)
subprocess.run(["docker", "rm", "-f", nginx_name], check=False,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
assert backend.stdin is not None
assert backend.stdout is not None
backend.stdin.write('"snapshot"\n')