Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b91f2182b | ||
|
|
5da997541b | ||
|
|
9aac3399e7 |
3 changed files with 25 additions and 8 deletions
4
.github/workflows/e2e_tests.yml
vendored
4
.github/workflows/e2e_tests.yml
vendored
|
|
@ -374,6 +374,8 @@ jobs:
|
||||||
- name: Run Entity Extraction Test
|
- name: Run Entity Extraction Test
|
||||||
env:
|
env:
|
||||||
ENV: 'dev'
|
ENV: 'dev'
|
||||||
|
# remove when https://github.com/BerriAI/litellm/issues/16810 is fixed
|
||||||
|
LITELLM_LOCAL_MODEL_COST_MAP: "True"
|
||||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||||
|
|
@ -402,6 +404,8 @@ jobs:
|
||||||
- name: Run Feedback Enrichment Test
|
- name: Run Feedback Enrichment Test
|
||||||
env:
|
env:
|
||||||
ENV: 'dev'
|
ENV: 'dev'
|
||||||
|
# remove when https://github.com/BerriAI/litellm/issues/16810 is fixed
|
||||||
|
LITELLM_LOCAL_MODEL_COST_MAP: "True"
|
||||||
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
LLM_MODEL: ${{ secrets.LLM_MODEL }}
|
||||||
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
|
||||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||||
|
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -13,6 +13,8 @@ __pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
|
|
||||||
|
mise.toml
|
||||||
|
|
||||||
full_run.ipynb
|
full_run.ipynb
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
from logging import getLogger
|
||||||
import unittest
|
import unittest
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
@ -8,6 +9,8 @@ from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from tenacity import retry, stop_after_attempt, wait_incrementing
|
||||||
|
|
||||||
|
|
||||||
class TestCogneeServerStart(unittest.TestCase):
|
class TestCogneeServerStart(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
@ -27,9 +30,7 @@ class TestCogneeServerStart(unittest.TestCase):
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
preexec_fn=os.setsid,
|
preexec_fn=os.setsid,
|
||||||
)
|
)
|
||||||
# Give the server some time to start
|
|
||||||
time.sleep(35)
|
|
||||||
|
|
||||||
# Check if server started with errors
|
# Check if server started with errors
|
||||||
if cls.server_process.poll() is not None:
|
if cls.server_process.poll() is not None:
|
||||||
|
|
@ -49,12 +50,22 @@ class TestCogneeServerStart(unittest.TestCase):
|
||||||
cls.server_process.terminate()
|
cls.server_process.terminate()
|
||||||
cls.server_process.wait()
|
cls.server_process.wait()
|
||||||
|
|
||||||
|
|
||||||
|
@retry(wait=wait_incrementing(start=5, increment=3), stop=stop_after_attempt(5))
|
||||||
|
def wait_for_server_startup(self):
|
||||||
|
print("Waiting for server to start...")
|
||||||
|
response = requests.get("http://localhost:8000/health", timeout=15)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
status_str = response.json().get("status")
|
||||||
|
if response.status_code == 200 and status_str == "ready":
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
getLogger().info(f"Health check status {response.status_code} : {status_str}, retrying...")
|
||||||
|
raise requests.exceptions.RequestException(f"Server is {status_str}")
|
||||||
|
|
||||||
def test_server_is_running(self):
|
def test_server_is_running(self):
|
||||||
"""Test that the server is running and can accept connections."""
|
self.wait_for_server_startup()
|
||||||
# Test health endpoint
|
|
||||||
health_response = requests.get("http://localhost:8000/health", timeout=15)
|
|
||||||
self.assertIn(health_response.status_code, [200])
|
|
||||||
|
|
||||||
# Test root endpoint
|
# Test root endpoint
|
||||||
root_response = requests.get("http://localhost:8000/", timeout=15)
|
root_response = requests.get("http://localhost:8000/", timeout=15)
|
||||||
self.assertEqual(root_response.status_code, 200)
|
self.assertEqual(root_response.status_code, 200)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue