From 13201edc4b036481277650dcac5cb35fd0718b0b Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Fri, 5 Jan 2024 13:37:31 +0530 Subject: [PATCH] (test) test reading configs on proxy --- litellm/tests/test_proxy_server.py | 44 ++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/litellm/tests/test_proxy_server.py b/litellm/tests/test_proxy_server.py index 0fb8c742a..972c4a583 100644 --- a/litellm/tests/test_proxy_server.py +++ b/litellm/tests/test_proxy_server.py @@ -285,29 +285,37 @@ from litellm.proxy.proxy_server import ProxyConfig def test_load_router_config(): try: + import asyncio + print("testing reading config") # this is a basic config.yaml with only a model filepath = os.path.dirname(os.path.abspath(__file__)) proxy_config = ProxyConfig() - result = proxy_config.load_config( - router=None, - config_file_path=f"{filepath}/example_config_yaml/simple_config.yaml", + result = asyncio.run( + proxy_config.load_config( + router=None, + config_file_path=f"{filepath}/example_config_yaml/simple_config.yaml", + ) ) print(result) assert len(result[1]) == 1 # this is a load balancing config yaml - result = load_router_config( - router=None, - config_file_path=f"{filepath}/example_config_yaml/azure_config.yaml", + result = asyncio.run( + proxy_config.load_config( + router=None, + config_file_path=f"{filepath}/example_config_yaml/azure_config.yaml", + ) ) print(result) assert len(result[1]) == 2 # config with general settings - custom callbacks - result = load_router_config( - router=None, - config_file_path=f"{filepath}/example_config_yaml/azure_config.yaml", + result = asyncio.run( + proxy_config.load_config( + router=None, + config_file_path=f"{filepath}/example_config_yaml/azure_config.yaml", + ) ) print(result) assert len(result[1]) == 2 @@ -315,9 +323,11 @@ def test_load_router_config(): # tests for litellm.cache set from config print("testing reading proxy config for cache") litellm.cache = None - load_router_config( - router=None, - config_file_path=f"{filepath}/example_config_yaml/cache_no_params.yaml", + asyncio.run( + proxy_config.load_config( + router=None, + config_file_path=f"{filepath}/example_config_yaml/cache_no_params.yaml", + ) ) assert litellm.cache is not None assert "redis_client" in vars( @@ -330,10 +340,14 @@ def test_load_router_config(): "aembedding", ] # init with all call types + litellm.disable_cache() + print("testing reading proxy config for cache with params") - load_router_config( - router=None, - config_file_path=f"{filepath}/example_config_yaml/cache_with_params.yaml", + asyncio.run( + proxy_config.load_config( + router=None, + config_file_path=f"{filepath}/example_config_yaml/cache_with_params.yaml", + ) ) assert litellm.cache is not None print(litellm.cache)