diff --git a/tests/integration/security/test_hide_secrets_tool_compatibility.py b/tests/integration/security/test_hide_secrets_tool_compatibility.py index 37122adac3c..d8b900de6d0 100644 --- a/tests/integration/security/test_hide_secrets_tool_compatibility.py +++ b/tests/integration/security/test_hide_secrets_tool_compatibility.py @@ -14,7 +14,8 @@ import anthropic import httpx import openai import pytest -from integration._support.client import eventually +from integration._support.budget import case_timeout_seconds +from integration._support.client import Gateway, eventually from integration._support.database import read_rows from integration._support.wire import Reply, Request from integration.security.test_hide_secrets_tool_traffic import ( @@ -491,9 +492,12 @@ def test_surviving_worker_redacts_mixed_burst_and_replacement_recovers(isolated_ index, marker = item provider: Final = "anthropic" if index % 2 else "openai" path: Final = "/v1/messages" if provider == "anthropic" else "/v1/chat/completions" - response: Final = caller.rig.proxy.request( - "POST", path, _body(provider, marker, stream=index % 3 == 0), key=caller.key - ) + proxy: Final = caller.rig.proxy + # a new connection per call: a pooled keep-alive socket to the killed worker can outlive the kill + with httpx.Client(base_url=proxy.client.base_url, timeout=case_timeout_seconds(), trust_env=False) as client: + response: Final = Gateway(client, proxy.key, proxy.upstream_url).request( + "POST", path, _body(provider, marker, stream=index % 3 == 0), key=caller.key + ) assert response.status_code == 200 and "accepted" in response.text, response.text return marker, f"{'msg' if provider == 'anthropic' else 'chatcmpl'}_{marker}" diff --git a/tests/integration/security/test_hide_secrets_tool_traffic.py b/tests/integration/security/test_hide_secrets_tool_traffic.py index a1886f50c9f..42fdc0f5a44 100644 --- a/tests/integration/security/test_hide_secrets_tool_traffic.py +++ b/tests/integration/security/test_hide_secrets_tool_traffic.py @@ -14,6 +14,7 @@ from typing import Final import httpx import pytest import yaml +from integration._support.budget import case_timeout_seconds from integration._support.client import Gateway from integration._support.database import scratch_database from integration._support.process import OwnedProxy, owned_proxy_process @@ -172,6 +173,7 @@ def tool_rig( child_environment, config=config, workers=workers, + client_timeout=case_timeout_seconds(), ) as owned: yield Rig(owned.gateway, wire, database, owned, child_environment)