The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test: qualify integration cleanup and replay invocation
Yuneng Jiangd7c13625e92e
diff --git a/.circleci/scripts/run_integration.sh b/.circleci/scripts/run_integration.shindex 57863c62a52..f12b5f48fc0 100644--- a/.circleci/scripts/run_integration.sh+++ b/.circleci/scripts/run_integration.sh@@ -14,7 +14,7 @@ guard6_installed=falsecleanup() {original_status=$?trap - EXIT INT TERM- .venv/bin/python .circleci/scripts/stop_integration_processes.py "$integration_identity" \+ sudo .venv/bin/python .circleci/scripts/stop_integration_processes.py "$integration_identity" "$(id -u)" \> "$results/process-cleanup.txt" 2>&1 || original_status=1for owned_pid in "$proxy_pid" "$upstream_pid"; doif [ -n "$owned_pid" ]; then@@ -128,7 +128,8 @@ with httpx.Client(trust_env=False, timeout=2) as client:PYif [ "$suite" = providers ]; then- INTEGRATION_RUN_ID="$integration_identity" .venv/bin/python -m pytest --noconftest -p no:pytest-retry -p no:rerunfailures --timeout=30 \+ INTEGRATION_RUN_ID="$integration_identity" .venv/bin/python -m pytest --noconftest -o addopts= \+ --strict-markers --strict-config -p no:pytest-retry -p no:rerunfailures --timeout=30 \tests/e2e/test_provider_edge.py::TestReplayMode::test_content_drift_returns_the_miss_status_naming_both_keys \tests/e2e/test_provider_edge.py::TestReplayMode::test_exhausted_key_returns_the_miss_status \tests/e2e/test_provider_edge.py::TestReplayLeftover::test_partially_consumed_recording_names_the_leftover \diff --git a/.circleci/scripts/stop_integration_processes.py b/.circleci/scripts/stop_integration_processes.pyindex ff4d53b9aaa..179a13fcaac 100644--- a/.circleci/scripts/stop_integration_processes.py+++ b/.circleci/scripts/stop_integration_processes.py@@ -1,14 +1,13 @@-import osimport sysfrom typing import Finalimport psutil-def owned_processes(identity: str) -> tuple[psutil.Process, ...]:+def owned_processes(identity: str, owner_uid: int) -> tuple[psutil.Process, ...]:owned: Final[list[psutil.Process]] = []for process in psutil.process_iter(["uids"]):- if process.info["uids"].real != os.getuid():+ if process.info["uids"].real != owner_uid:continuetry:if process.environ().get("INTEGRATION_RUN_ID") == identity:@@ -18,25 +17,26 @@ def owned_processes(identity: str) -> tuple[psutil.Process, ...]:return tuple(owned)-def main(identity: str) -> int:- owned: Final = owned_processes(identity)+def main(identity: str, owner_uid: int) -> int:+ assert owner_uid > 0, "The integration process owner must be a non-root UID"+ owned: Final = owned_processes(identity, owner_uid)for process in owned:try:process.terminate()except psutil.NoSuchProcess:continuepsutil.wait_procs(owned, timeout=8)- remaining: Final = owned_processes(identity)+ remaining: Final = owned_processes(identity, owner_uid)for process in remaining:try:process.kill()except psutil.NoSuchProcess:continuepsutil.wait_procs(remaining, timeout=2)- survivors: Final = owned_processes(identity)+ survivors: Final = owned_processes(identity, owner_uid)print(f"Owned integration processes: {len(owned)}, forced: {len(remaining)}, remaining: {len(survivors)}")return 1 if remaining or survivors else 0if __name__ == "__main__":- raise SystemExit(main(sys.argv[1]))+ raise SystemExit(main(sys.argv[1], int(sys.argv[2])))