Fix flaky hosted API tests: unify SQLite timeout, increase httpx timeout, fix missing await
Three root causes addressed for flaky test failures on main:
1. SQLite busy_timeout was 30s in test mode vs 60s in production. Under
heavy parallel test execution (pytest-xdist), the hosted API server
subprocess and test process compete for the same SQLite file, causing
lock contention that can exceed 30s. Unified to 60s for all modes.
2. hosted_api_client used the default httpx timeout of 5s. When the hosted
server is slow to respond under CI load (e.g., waiting on SQLite locks),
5s is insufficient. Increased to 30s.
3. test_delete_task_run_deletes_logs had a missing 'await' on
asyncio.sleep(1), creating a tight polling loop that hammered the DB
instead of yielding between retries.
Failing tests:
- test_get_runs_in_queue_concurrency_limit_and_limit[1] (httpx.ReadError)
- test_delete_task_run_deletes_logs (httpx.ConnectTimeout)
Co-authored-by: bot_apk <apk@cognition.ai>
Make telemetry metrics module private
Rename src/prefect/telemetry/metrics.py to src/prefect/telemetry/_metrics.py
and update all imports and mock paths accordingly.
Co-authored-by: alex.s <alex.s@prefect.io>
Co-Authored-By: alex.s <ajstreed1@gmail.com>