test(e2e): assert budget-isolation invariant before success check

On the should-still-succeed path of the per-model and tag isolation
tests, check is_budget_block before require_successful_call. If the
isolation bug fires the unaffected model/tag is blocked, so asserting
the specific 'blocked by X' invariant first yields the diagnostic
message instead of a generic upstream-failure. Matches the ordering in
test_soft_budget_e2e.py.
This commit is contained in:
mateo-berri 2026-06-20 06:01:53 +00:00
parent 3908c4eda2
commit 59855b5417
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -51,7 +51,7 @@ def test_model_max_budget_isolates_per_model(
# The other model shares the key but has its own (large) cap -> still works.
other = _call(client, key, FREE_MODEL)
require_successful_call(other) # its own large cap -> must succeed, never a budget block
assert not is_budget_block(other), (
f"{FREE_MODEL} was blocked by {CAPPED_MODEL}'s budget; per-model caps not isolated"
)
require_successful_call(other)

View file

@ -53,7 +53,7 @@ def test_tag_budget_blocks_tagged_requests(
# A request with an unbudgeted tag on the same key is unaffected.
free_tag = f"e2e-free-tag-{unique_marker()}"
other = _tagged_call(client, scoped_key, free_tag)
require_successful_call(other)
assert not is_budget_block(other), (
f"unbudgeted tag {free_tag!r} was blocked by {budgeted_tag!r}'s budget"
)
require_successful_call(other)