Skip to content

Commit 79db02a

Browse files
committed
test(e2e): broaden race-rejection body match for double-stop
The double-stop case asserts the response body explains the race-protection rejection so a 'box stopped on accident, no explanation' regression can still trip it. Tokyo's Api now returns HTTP 400 with 'Box is not started' (one of several stable wordings the API has picked for the same invariant: current state doesn't admit this transition). Accept 'not started' / 'already stopped' / 'invalid state' alongside the existing 'state change' phrasing — all four are semantically equivalent for the race-protection check the test is gating.
1 parent 13c8894 commit 79db02a

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

scripts/test/e2e/cases/test_error_code_mapping.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,19 @@ async def test_invalid_state_stop_already_stopped_returns_4xx(rt, image):
275275
f"double-stop leaked HTTP {status2} (5xx); body={body_str}"
276276
)
277277
if status2 not in (200, 204, 409):
278-
assert "state change" in body_str.lower(), (
279-
f"double-stop got HTTP {status2} but body doesn't explain the "
280-
f"race-protection rejection: {body_str}"
278+
# 400 'Box is not started' / 'already stopped' / 'state change in
279+
# progress' are all valid race-protection rejections — the API
280+
# has picked different wording across deploys for the same
281+
# invariant (current state doesn't admit this transition).
282+
body_lower = body_str.lower()
283+
assert (
284+
"state change" in body_lower
285+
or "not started" in body_lower
286+
or "already stopped" in body_lower
287+
or "invalid state" in body_lower
288+
), (
289+
f"double-stop got HTTP {status2} but body doesn't explain "
290+
f"the race-protection rejection: {body_str}"
281291
)
282292
finally:
283293
# Tolerate the race here too — the runner may still be in

0 commit comments

Comments
 (0)