test: diagnose proxy startup failures
This commit is contained in:
@@ -10,6 +10,7 @@ import shutil
|
||||
import socket
|
||||
import ssl
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
@@ -194,6 +195,7 @@ def main() -> None:
|
||||
try:
|
||||
backend_port = wait_for_native(backend, 120)
|
||||
write_nginx_config(directory / "nginx.conf", backend_port, edge_port)
|
||||
print(f"proxy backend=127.0.0.1:{backend_port} edge=127.0.0.1:{edge_port}", flush=True)
|
||||
nginx = subprocess.Popen(
|
||||
[
|
||||
"docker", "run", "--rm", "--pull=missing", "--name", nginx_name,
|
||||
@@ -218,7 +220,18 @@ def main() -> None:
|
||||
else:
|
||||
raise RuntimeError("Nginx did not start listening")
|
||||
|
||||
wait_for_proxy(edge_port, 30)
|
||||
try:
|
||||
wait_for_proxy(edge_port, 30)
|
||||
except Exception as error:
|
||||
nginx_logs = subprocess.run(
|
||||
["docker", "logs", nginx_name], capture_output=True, text=True, check=False
|
||||
).stdout[-2000:]
|
||||
backend_logs = subprocess.run(
|
||||
["docker", "logs", backend_name], capture_output=True, text=True, check=False
|
||||
).stdout[-2000:]
|
||||
raise RuntimeError(
|
||||
f"{error}; nginx logs={nginx_logs!r}; backend logs={backend_logs!r}"
|
||||
) from error
|
||||
verify_keep_alive(edge_port)
|
||||
verify_timeout(edge_port)
|
||||
print("PASS Nginx TLS proxy, Keep-Alive and upstream timeout", flush=True)
|
||||
|
||||
Reference in New Issue
Block a user