test(proxy): set the unsafe-proxy override at the remaining test boot sites and isolate the boot test from a leaked scheduler

This commit is contained in:
ryan-crabbe-berri 2026-09-19 14:16:52 -07:00
parent 0049a51f9b
commit 3c9c860de7
3 changed files with 4 additions and 0 deletions

View file

@ -54,6 +54,7 @@ def _clear_proxy_database_env() -> typing.Iterator[None]:
# the LITELLM_MASTER_KEY env var, overriding whatever initialize() set from
# the config file. We must set it here so the lifespan doesn't reset it to None.
mp.setenv("LITELLM_MASTER_KEY", "sk-1234")
mp.setenv("LITELLM_DANGEROUSLY_ALLOW_UNSAFE_PROXY", "true")
try:
yield
finally:

View file

@ -268,6 +268,7 @@ def create_proxy_test_client(
# Set environment variables
set_proxy_environment_variables(monkeypatch, database_url=database_url)
monkeypatch.setenv("LITELLM_DANGEROUSLY_ALLOW_UNSAFE_PROXY", "true")
# Initialize proxy
asyncio.run(initialize(config=config_fp, debug=init_options.get("debug", False)))

View file

@ -1636,6 +1636,8 @@ def _boot_with_general_settings(monkeypatch, tmp_path, general_settings):
for name in ("LITELLM_MASTER_KEY", "LITELLM_DANGEROUSLY_ALLOW_UNSAFE_PROXY", "WORKER_CONFIG", "DATABASE_URL"):
monkeypatch.delenv(name, raising=False)
monkeypatch.setenv("CONFIG_FILE_PATH", str(config_path))
scheduler_left_on_a_closed_event_loop_by_an_earlier_test = "litellm.proxy.proxy_server.scheduler"
monkeypatch.setattr(scheduler_left_on_a_closed_event_loop_by_an_earlier_test, None)
announced = []
monkeypatch.setattr("litellm.proxy.proxy_server.announce_on_stderr_at_exit", announced.append)
return config_path, announced