From ee50f2bc448d004c757ab2ddea21ac7e5a83baf4 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Fri, 4 Sep 2026 18:50:47 -0700 Subject: [PATCH] test(e2e/batches): run the list assertion when a batch completes before cancel The completed-batch early return skipped both the cancel and the list assertion while the lifecycle's covers markers still credited both cells. List does not depend on the batch being cancellable, so it now runs either way; cancel on a completed batch stays a documented vacuous pass --- tests/e2e/batches/COVERAGE.md | 2 +- tests/e2e/batches/test_batches_e2e.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/e2e/batches/COVERAGE.md b/tests/e2e/batches/COVERAGE.md index 2b1f60cbda7..8a7b68511ec 100644 --- a/tests/e2e/batches/COVERAGE.md +++ b/tests/e2e/batches/COVERAGE.md @@ -25,7 +25,7 @@ Bedrock cancel maps to `StopModelInvocationJob` and comes back `cancelling`; the lifecycle asserts it the same way it does for OpenAI (`_CANCEL_ASSERTED_PROVIDERS`). Bedrock has no provider-side list, so list is the proxy's DB-backed managed view: the unified lifecycle lists with the plain `GET /v1/batches` and the batch must appear -there. Both were gated off until LIT-5730, after LIT-4774 landed cancel support. +there. Both were gated off until LIT-5730, after LIT-4774 landed cancel support. A batch that completes inside the 2 s pre-cancel window skips the cancel assertion (a documented vacuous pass for the cancel cell, same as OpenAI); the list assertion runs either way. Bedrock file upload requires a model on the request (`encoded` / `unified` scenarios only); `model_param` and `provider_fallback` are omitted because `POST /bedrock/v1/files` has no model-less passthrough path. diff --git a/tests/e2e/batches/test_batches_e2e.py b/tests/e2e/batches/test_batches_e2e.py index cb9954b8e09..ed7cf656d01 100644 --- a/tests/e2e/batches/test_batches_e2e.py +++ b/tests/e2e/batches/test_batches_e2e.py @@ -293,14 +293,13 @@ def test_batch_lifecycle( f"batch reached {pre_cancel.status!r} before cancel; " "provider likely rejected the input" ) - if pre_cancel.status == "completed": - return - cancelled = cancel_batch(client, batch.id, key=key, provider=provider) - assert cancelled.id == batch.id - assert cancelled.object == "batch" - assert cancelled.status in {"cancelling", "cancelled"}, ( - f"unexpected post-cancel status {cancelled.status!r}" - ) + if pre_cancel.status != "completed": + cancelled = cancel_batch(client, batch.id, key=key, provider=provider) + assert cancelled.id == batch.id + assert cancelled.object == "batch" + assert cancelled.status in {"cancelling", "cancelled"}, ( + f"unexpected post-cancel status {cancelled.status!r}" + ) if cap.can_list: list_result = client.list_batches(key=key, provider=provider)