From 15665a6918f2bcf5772302bbbf0ede548b1b4217 Mon Sep 17 00:00:00 2001 From: yucheng Date: Wed, 23 Sep 2026 12:12:51 +0000 Subject: [PATCH] test(s3_v2): ignore stray non-POST requests in the surface upstream Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- tests/integration/observability/_s3_v2_support.py | 2 ++ .../integration/observability/test_s3_v2_flush_surfaces.py | 6 +++--- .../integration/observability/test_s3_v2_upload_fanout.py | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/integration/observability/_s3_v2_support.py b/tests/integration/observability/_s3_v2_support.py index 87100e108b5..104c0eda863 100644 --- a/tests/integration/observability/_s3_v2_support.py +++ b/tests/integration/observability/_s3_v2_support.py @@ -216,6 +216,8 @@ def _responses_stream_frames(identity: str) -> tuple[bytes, ...]: def surface_reply(request: Request) -> Reply: """Scripted upstream that echoes the caller's marker string back as the response id.""" + if request.method != "POST" or not request.body: + return Reply(status=404) body: Final = json.loads(request.body) if request.target.endswith("/chat/completions"): identity: Final = body["messages"][0]["content"] diff --git a/tests/integration/observability/test_s3_v2_flush_surfaces.py b/tests/integration/observability/test_s3_v2_flush_surfaces.py index 069f27270dc..2e0b7260a13 100644 --- a/tests/integration/observability/test_s3_v2_flush_surfaces.py +++ b/tests/integration/observability/test_s3_v2_flush_surfaces.py @@ -42,7 +42,7 @@ def test_s3_v2_mixed_surface_burst_bounds_puts_one_object_per_response_id(gatewa answered: Final = mixed_burst(candidate, openai_model, anthropic_model, key, marker) payloads: Final = collect_payloads(sink, len(answered)) targets: Final = tuple(sink.objects()) - assert len(provider.drain()) == 48 + assert sum(1 for r in provider.drain() if r.method == "POST") == 48 assert sink.peak <= 16, f"peak concurrent PUTs {sink.peak} exceeded the default bound" assert all(PER_REQUEST_KEY.match(target) for target in targets), list(targets) assert len(targets) == 48 @@ -68,7 +68,7 @@ def test_s3_v2_mixed_surface_batch_writes_ndjson_lines_per_response_id(gateway: payloads: Final = collect_payloads(sink, len(answered)) targets: Final = tuple(sink.objects()) puts: Final = bucket.drain() - assert len(provider.drain()) == 48 + assert sum(1 for r in provider.drain() if r.method == "POST") == 48 assert all(BATCH_KEY.match(target) for target in targets), list(targets) assert all(put.headers["content-type"] == "application/x-ndjson" for put in puts), [put.headers for put in puts] assert matched_ids(payloads, answered) @@ -92,6 +92,6 @@ def test_s3_v2_sink_outage_mid_mixed_burst_recovers_every_response_id(gateway: G key: Final = scenario.key(models=[openai_model, anthropic_model]) answered: Final = mixed_burst(candidate, openai_model, anthropic_model, key, marker) payloads: Final = collect_payloads(sink, len(answered), seconds=90) - assert len(provider.drain()) == 48 + assert sum(1 for r in provider.drain() if r.method == "POST") == 48 assert matched_ids(payloads, answered) assert len(payloads) == 48, "a stored id was overwritten or duplicated" diff --git a/tests/integration/observability/test_s3_v2_upload_fanout.py b/tests/integration/observability/test_s3_v2_upload_fanout.py index 389e03e76cb..3ebca152327 100644 --- a/tests/integration/observability/test_s3_v2_upload_fanout.py +++ b/tests/integration/observability/test_s3_v2_upload_fanout.py @@ -382,7 +382,12 @@ def test_s3_v2_unknown_model_rejection_keeps_other_requests_logging(gateway: Gat ) assert ghost.status_code in (400, 403, 404), ghost.text ids: Final = _burst(candidate, model, key, marker) - payloads: Final = collect_payloads(sink, REQUESTS) + eventually( + lambda: frozenset(payload["id"] for payload in sink.payloads()), + lambda landed: ids <= landed, + seconds=90, + ) + payloads: Final = sink.payloads() assert sum(1 for r in provider.drain() if r.method == "POST") == REQUESTS assert ids <= frozenset(payload["id"] for payload in payloads) extras: Final = tuple(payload for payload in payloads if payload["id"] not in ids)