test: fix integration tests that fail on test order, races and intended changes (#49310)

Seven integration tests fail on main for reasons that are not product bugs. Two are order or race bugs in the tests, one reads rows other tests wrote, one passed on an error body, and three still expect behavior that #48644, #39864 and #39540 changed on purpose
This commit is contained in:
yuneng-jiang 2026-10-30 13:25:47 -07:00 • committed by GitHub
parent 632f71b850
commit fbd126e518
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 27 additions and 11 deletions

View file

@ -1199,7 +1199,7 @@ def test_anthropic_messages_explicit_null_reaches_upstream(gateway: Gateway) ->
"anthropic_messages",
deployment_params={"max_tokens": 32},
provider_model="openai/gpt-4o-mini",
response_route="acompletion",
response_route="aresponses",
)
response: Final = _post(
gateway,

View file

@ -1033,13 +1033,14 @@ def test_the_entry_size_check_draws_the_line_exactly_where_postgres_does(
create_index: Final = sql.SQL('CREATE INDEX "entry_probe_idx" ON "entry_probe" ({})').format(
sql.SQL(", ").join(sql.Identifier(column) for column in index_columns)
)
fitting_key: Final = secrets.token_hex(longest_fitting_key)[:longest_fitting_key]
with psycopg.connect(scratch_database, autocommit=True) as conn:
conn.execute('CREATE TABLE "entry_probe" ("s" TEXT, "k" TEXT, "t" TIMESTAMP(3))')
conn.execute(
'INSERT INTO "entry_probe" ("s", "k", "t") VALUES (%s, %s, %s), (%s, %s, %s)',
(
s_value,
secrets.token_hex(longest_fitting_key)[:longest_fitting_key],
fitting_key,
t_value,
s_value,
secrets.token_hex(longest_fitting_key)[: longest_fitting_key + 1],
@ -1051,7 +1052,8 @@ def test_the_entry_size_check_draws_the_line_exactly_where_postgres_does(
)
with pytest.raises(psycopg.errors.ProgramLimitExceeded, match="exceeds btree version 4 maximum 2704"):
conn.execute(create_index)
conn.execute('DELETE FROM "entry_probe" WHERE octet_length("k") > %s', (longest_fitting_key,))
conn.execute('TRUNCATE "entry_probe"')
conn.execute('INSERT INTO "entry_probe" ("s", "k", "t") VALUES (%s, %s, %s)', (s_value, fitting_key, t_value))
conn.execute(create_index)
(finding,) = findings
@ -1075,7 +1077,8 @@ def test_a_value_postgres_compresses_under_the_limit_is_not_counted_while_random
)
with pytest.raises(psycopg.errors.ProgramLimitExceeded, match="index row size 3016 exceeds"):
conn.execute(create_index)
conn.execute('DELETE FROM "compress_probe" WHERE "k" <> %s', ("a" * 3000,))
conn.execute('TRUNCATE "compress_probe"')
conn.execute('INSERT INTO "compress_probe" ("k") VALUES (%s)', ("a" * 3000,))
conn.execute(create_index)
stored: Final = conn.execute('SELECT octet_length("k"), pg_column_size("k") FROM "compress_probe"').fetchone()

View file

@ -23,7 +23,7 @@ import yaml
from integration._support.client import Gateway, eventually, object_value
from integration._support.database import read_rows
from integration._support.mcp import mcp_peer, register_mcp, tool_names
from integration._support.process import OwnedProxy, owned_proxy, owned_proxy_process
from integration._support.process import OwnedProxy, OwnedState, owned_proxy, owned_proxy_process
from integration._support.wire import Reply, Request, Wire, wire_server
from integration._support.ports import allocate_port
from openai import APIError, AsyncOpenAI, OpenAI
@ -3263,7 +3263,10 @@ def test_client_disconnect_during_the_body_upload_runs_no_endpoint_and_writes_no
with (
wire_server(_openai_upstream) as upstream,
owned_proxy_process(
gateway, tmp_path, {"OPENAI_BASE_URL": upstream.url + "/v1", "OPENAI_API_KEY": "synthetic-openai-key"}
gateway,
tmp_path,
{"OPENAI_BASE_URL": upstream.url + "/v1", "OPENAI_API_KEY": "synthetic-openai-key"},
state=OwnedState.PRIVATE,
) as owned,
owned.gateway.scenario() as scenario,
):

View file

@ -501,7 +501,7 @@ def test_vertex_batch_file_rows_carry_the_mapped_voice(gateway: Gateway) -> None
assert tuple(text_in(row) for row in rows) == (first, second)
def test_vertex_live_default_mode_sends_one_setup_without_the_client_voice(gateway: Gateway) -> None:
def test_vertex_live_sends_one_setup_carrying_the_mapped_session_update_voice(gateway: Gateway) -> None:
with gateway.scenario() as scenario:
handle: Final = live_scenario(scenario)
key: Final = scenario.key()
@ -511,7 +511,7 @@ def test_vertex_live_default_mode_sends_one_setup_without_the_client_voice(gatew
assert types[0] == "session.created" and types[-1] == "response.done", frames
setups: Final = live_setups(gateway, handle.scenario_id)
assert len(setups) == 1, setups
assert voice_in(setups[0]) == NO_VOICE, setups[0]
assert voice_in(setups[0]) == "Umbriel", setups[0]
@dataclass(frozen=True, slots=True)

View file

@ -279,7 +279,11 @@ def cooldown_rig(tmp_path_factory: pytest.TempPathFactory) -> Iterator[_Cooldown
upstream,
directory,
{"PROXY_CONFIG_RELOAD_INTERVAL_SECONDS": "2"},
config=cooldown_config(directory, router_settings(cache, allowed_fails=0), prometheus=False),
config=cooldown_config(
directory,
router_settings(cache, allowed_fails=0, allowed_fails_policy={"TimeoutErrorAllowedFails": 0}),
prometheus=False,
),
)
)
yield _CooldownRig(owned.gateway, cache)

View file

@ -593,7 +593,7 @@ def test_health_routing_fallbacks_preserve_error_specific_targets_and_request_co
"choices": [{"index": 0, "delta": {"role": "assistant", "content": ""}}],
}, response_text
assert {key: events[1]["error"][key] for key in events[1]["error"] if key != "message"} == {
"type": None,
"type": "internal_server_error",
"param": None,
"code": "500",
}, response_text

View file

@ -140,9 +140,15 @@ def _key(rig: Rig, *, permissions: dict[str, JsonValue] | None = None) -> Iterat
)
def _without_cooldowns(configuration: dict[str, JsonValue]) -> None:
settings: Final = configuration["router_settings"]
assert isinstance(settings, dict)
settings["disable_cooldowns"] = True
@pytest.fixture(scope="module")
def caller(tmp_path_factory: pytest.TempPathFactory) -> Iterator[Caller]:
with tool_rig(tmp_path_factory.mktemp("hide-secrets-compat"), _peer) as rig:
with tool_rig(tmp_path_factory.mktemp("hide-secrets-compat"), _peer, configure=_without_cooldowns) as rig:
with _key(rig) as key:
yield Caller(rig, key)