litellm/tests/unit/proxy/common_utils
yuneng-jiang 1587faeeb9
test(unit): wait on the work itself instead of fixed sleeps (#46261)
* test(unit): wait on the work itself instead of fixed sleeps in 21 flaky files

Replace sleeps that raced background logging, cache writes, refreshes and
thread work with either awaiting that work directly (logging worker flush,
the batch logger's flush_queue, the tasks the call spawned, thread joins) or
an Event the test's own fake sets when it runs. Each wait keeps a 5s hang
guard that never decides pass or fail. Tests that need a fake clock, real
sockets, or measure latency are left unchanged, and no production code moves

* test(unit): await the tasks each completion spawns instead of yielding once

The logging tests yielded once with asyncio.sleep(0) so the task that
enqueues the success log could run before the worker flush. That relied
on the enqueue happening before the task's first await. Snapshot the
running tasks around each acompletion call and await the ones it spawned,
so the guarantee holds however many steps sit before the enqueue
2026-10-13 12:41:06 -07:00
..
html_forms
__init__.py
test_admin_ui_utils.py
test_auth_cache_invalidation_pubsub.py test(unit): wait on the work itself instead of fixed sleeps (#46261) 2026-10-13 12:41:06 -07:00
test_cache_aware_routing.py
test_cache_codec.py
test_callback_config_validation.py feat(otel): let a team or key excluded_services override the global setting for its OTel v2 destination (#45880) 2026-10-12 19:25:52 -04:00
test_callback_utils.py
test_check_batch_cost.py fix(proxy): save file details for every batch output file so they list and retrieve (#41761) 2026-10-08 18:51:45 -07:00
test_check_responses_cost.py
test_codex_model_catalog.py
test_config_sync_pubsub.py
test_credential_hydration.py
test_custom_openapi_spec.py docs(proxy): describe /v1/decisions and /v1/systemone in Swagger UI (#45838) 2026-10-10 21:04:59 +00:00
test_debug_utils.py
test_discoverable_model_filter.py
test_encrypt_decrypt_utils.py
test_error_body_call_id.py
test_expired_ui_session_key_cleanup_manager.py
test_fips.py
test_get_routes.py
test_http_parsing_utils.py refactor(lens): connect LiteLLM to the independent Lens service (#45529) 2026-10-09 16:17:05 -07:00
test_json_merge_patch.py
test_key_rotation_e2e.py
test_key_rotation_integration.py
test_key_rotation_lock.py
test_key_rotation_manager.py
test_load_config_utils.py
test_model_deprecation.py
test_model_listing_utils.py
test_openai_endpoint_utils.py
test_openai_error_payload.py
test_periodic_reload_schedule.py
test_proxy_encrypt_decrypt.py
test_rbac_utils.py
test_realtime_cache.py
test_registry_read_through.py feat(decisions): add Databricks ai_decide as a /v1/decisions provider and auto-router decider (#45200) 2026-10-09 16:19:23 -07:00
test_reset_budget_job.py test: move offline proxy auth, hook, spend and pass-through tests to tests/unit (#45568) 2026-10-09 09:49:13 -07:00
test_resource_ownership.py refactor(core_utils): move resource_ownership out of the proxy (#45805) 2026-10-10 21:02:53 +00:00
test_scheduled_job_stagger.py
test_sse_keepalive.py
test_static_asset_utils.py
test_swagger_utils.py
test_timezone_utils.py
test_upsert_budget_membership.py feat(proxy): per-model team member budgets with router fallback (#43887) 2026-10-10 20:33:55 +00:00
test_user_api_key_cache.py
test_validation_error_body.py