test(caching): bind the redaction test to a closed port, not 6379

Constructing RedisCache runs a synchronous startup ping, which the
redis_no_ping fixture does not suppress. Using the default port 6379 meant
that ping could reach a real local Redis, adding latency and letting local
Redis availability sway an otherwise isolated unit test. Use _closed_port(),
like the sibling circuit-breaker tests, so the ping refuses immediately and
the test stays hermetic.
This commit is contained in:
mubashir1osmani 2026-08-10 18:23:56 -07:00
parent 16f1f93d6e
commit 3e86bafbde

View file

@ -672,7 +672,7 @@ async def test_redis_write_failure_does_not_log_master_key(redis_no_ping, call_c
"""
from litellm._logging import verbose_logger
cache: Final = RedisCache(host="127.0.0.1", port=6379, socket_timeout=0.5)
cache: Final = RedisCache(host="127.0.0.1", port=_closed_port(), socket_timeout=0.5)
capture: Final = _CaptureRecords()
verbose_logger.addFilter(capture)
try: