From 12a419864dec5a064475da7afa44bed85e7c569c Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 25 Nov 2024 21:00:24 -0800 Subject: [PATCH] test_redis_with_ssl --- tests/local_testing/test_caching_ssl.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/local_testing/test_caching_ssl.py b/tests/local_testing/test_caching_ssl.py index 0825a8537f75..98c3335de03e 100644 --- a/tests/local_testing/test_caching_ssl.py +++ b/tests/local_testing/test_caching_ssl.py @@ -99,3 +99,28 @@ def test_caching_router(): # test_caching_router() +@pytest.mark.asyncio +async def test_redis_with_ssl(): + """ + Test connecting to redis connection pool when ssl=None + + + Relevant issue: + User was seeing this error: `TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'ssl'` + """ + from litellm._redis import get_redis_connection_pool, get_redis_async_client + + # Get the connection pool with SSL + pool = get_redis_connection_pool( + host=os.environ.get("REDIS_HOST"), + port=os.environ.get("REDIS_PORT"), + password=os.environ.get("REDIS_PASSWORD"), + ssl=None, + ) + + # Create Redis client with the pool + redis_client = get_redis_async_client(connection_pool=pool) + + print("pinging redis") + print(await redis_client.ping()) + print("pinged redis")