test(test_python_38.py): add coverage for non-gen settings config.yaml flow

Adds testing for this https://github.com/BerriAI/litellm/issues/4324
This commit is contained in:
Krrish Dholakia 2024-06-20 20:29:10 -07:00
parent 3feaf231ac
commit 40ca30813e
2 changed files with 158 additions and 6 deletions

View file

@ -1,7 +1,11 @@
import sys, os, time
import traceback, asyncio
import pytest
import asyncio
import os
import subprocess
import sys
import time
import traceback
import pytest
sys.path.insert(
0, os.path.abspath("../..")
@ -31,3 +35,49 @@ def test_litellm_proxy_server():
# Assertion to satisfy the test, you can add other checks as needed
assert True
import os
import subprocess
import time
import pytest
import requests
def test_litellm_proxy_server_config_no_general_settings():
# Install the litellm[proxy] package
# Start the server
try:
filepath = os.path.dirname(os.path.abspath(__file__))
config_fp = f"{filepath}/test_configs/test_config_no_auth.yaml"
server_process = subprocess.Popen(
[
"python",
"-m",
"litellm.proxy.proxy_cli",
"--config",
config_fp,
]
)
# Allow some time for the server to start
time.sleep(5) # Adjust the sleep time if necessary
# Send a request to the /health/liveliness endpoint
response = requests.get("http://localhost:4000/health/liveliness")
# Check if the response is successful
assert response.status_code == 200
assert response.json() == "I'm alive!"
except ImportError:
pytest.fail("Failed to import litellm.proxy_server")
except requests.ConnectionError:
pytest.fail("Failed to connect to the server")
finally:
# Shut down the server
server_process.terminate()
server_process.wait()
# Additional assertions can be added here
assert True