From 8e70e83f773ba496bc49f1c7bf479568dd68fd39 Mon Sep 17 00:00:00 2001 From: yucheng Date: Thu, 24 Sep 2026 15:15:52 +0000 Subject: [PATCH] test(integration): slow half the kill-worker burst so the kill lands mid-flight Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- tests/integration/_support/tls.py | 3 +++ .../configuration/test_tls_cipher_proxy.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/integration/_support/tls.py b/tests/integration/_support/tls.py index 06296ece85a..fd06f5053ae 100644 --- a/tests/integration/_support/tls.py +++ b/tests/integration/_support/tls.py @@ -5,6 +5,7 @@ import ipaddress import json import ssl import threading +import time from collections.abc import Generator from contextlib import contextmanager from dataclasses import dataclass @@ -140,6 +141,8 @@ class _CipherPeerHandler(BaseHTTPRequestHandler): user_value: Final = body.get("user") user: Final = user_value if isinstance(user_value, str) else None peer.record(TlsPeerRequest(path=self.path, user=user, cipher=_negotiated_cipher(self))) + if user is not None and "slow" in user: + time.sleep(5) identifier: Final = f"chatcmpl-{user or ''}" model_value: Final = body.get("model") model: Final = model_value if isinstance(model_value, str) else "gpt-4o-mini" diff --git a/tests/integration/configuration/test_tls_cipher_proxy.py b/tests/integration/configuration/test_tls_cipher_proxy.py index b261af86207..1a492a4dfd6 100644 --- a/tests/integration/configuration/test_tls_cipher_proxy.py +++ b/tests/integration/configuration/test_tls_cipher_proxy.py @@ -308,7 +308,7 @@ class _BurstOutcome: def _chaos_request(proxy: Gateway, kind: str, index: int, marker: str) -> _BurstOutcome: user: Final = f"chaos-{kind}-{index}-{marker}" - if kind == "chat": + if kind in ("chat", "slow"): try: chat_response: Final = proxy.request( "POST", @@ -429,7 +429,10 @@ def test_proxy_burst_survives_losing_one_worker(cipher_owned_proxy: OwnedProxy, marker: Final = uuid.uuid4().hex[:8] executor: Final = ThreadPoolExecutor(max_workers=12) with executor: - futures: Final = tuple(executor.submit(_chaos_request, proxy, "chat", index, marker) for index in range(12)) + futures: Final = tuple( + executor.submit(_chaos_request, proxy, "slow" if index % 2 else "chat", index, marker) + for index in range(12) + ) eventually( lambda: sum(1 for future in futures if future.done() and future.result().status == 200), lambda successes: successes >= 2, @@ -441,7 +444,9 @@ def test_proxy_burst_survives_losing_one_worker(cipher_owned_proxy: OwnedProxy, children[0].kill() finished: Final = tuple(future.result(timeout=120) for future in futures) assert len(finished) == 12, finished - assert any(outcome.status == 200 and outcome.finished_at > killed_at for outcome in finished), finished + assert any(outcome.finished_at > killed_at for outcome in finished), finished + post_kill_id: Final = _sync_completion(proxy, "tls-peer", f"post-kill-{marker}") + assert post_kill_id == f"chatcmpl-post-kill-{marker}" def _ready() -> bool: try: