Files
deer-flow/backend/tests/test_gateway_runtime_cleanup.py
Willem Jiang 028493bfd8 fix(docker):force ngix to resolve upstream names at request time (#2717)
* fix(docker):force ngix to resolve upstream names at request time

* fix(docker): set resolver valid=0s to eliminate DNS cache window for request-time re-resolution

Agent-Logs-Url: https://github.com/bytedance/deer-flow/sessions/07bdb872-022f-4fd2-9fa8-d800a4ce34a7

Co-authored-by: WillemJiang <219644+WillemJiang@users.noreply.github.com>

* Update DNS resolver valid time and add upstreams

* fix the unit test error

* Remove upstream server configurations from nginx.conf

Removed upstream server configurations for gateway and frontend.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-05-05 14:35:55 +08:00

63 lines
2.3 KiB
Python

"""Regression coverage for the Gateway-owned LangGraph API runtime."""
from __future__ import annotations
import re
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
def _read(path: str) -> str:
return (REPO_ROOT / path).read_text(encoding="utf-8")
def test_root_makefile_no_longer_exposes_transition_gateway_targets():
makefile = _read("Makefile")
assert "dev-pro" not in makefile
assert "start-pro" not in makefile
assert "dev-daemon-pro" not in makefile
assert "start-daemon-pro" not in makefile
assert "docker-start-pro" not in makefile
assert "up-pro" not in makefile
assert not re.search(r"serve\.sh .*--gateway", makefile)
assert "docker.sh start --gateway" not in makefile
assert "deploy.sh --gateway" not in makefile
def test_service_launchers_always_use_gateway_runtime():
operational_files = {
"scripts/serve.sh": _read("scripts/serve.sh"),
"scripts/docker.sh": _read("scripts/docker.sh"),
"scripts/deploy.sh": _read("scripts/deploy.sh"),
"docker/docker-compose-dev.yaml": _read("docker/docker-compose-dev.yaml"),
"docker/docker-compose.yaml": _read("docker/docker-compose.yaml"),
}
for path, content in operational_files.items():
assert "start --gateway" not in content, path
assert "deploy.sh --gateway" not in content, path
assert "langgraph dev" not in content, path
assert "LANGGRAPH_UPSTREAM" not in content, path
assert "LANGGRAPH_REWRITE" not in content, path
def test_nginx_routes_official_langgraph_prefix_to_gateway_api():
for path in ("docker/nginx/nginx.local.conf", "docker/nginx/nginx.conf"):
content = _read(path)
assert "/api/langgraph-compat" not in content
assert "proxy_pass http://langgraph" not in content
assert "rewrite ^/api/langgraph/(.*) /api/$1 break;" in content
assert "proxy_pass http://gateway" in content or "proxy_pass http://$gateway_upstream" in content
def test_frontend_rewrites_langgraph_prefix_to_gateway():
next_config = _read("frontend/next.config.js")
api_client = _read("frontend/src/core/api/api-client.ts")
assert "DEER_FLOW_INTERNAL_LANGGRAPH_BASE_URL" not in next_config
assert "http://127.0.0.1:2024" not in next_config
assert "langgraph-compat" not in api_client