Skip to content

Commit 72e602b

Browse files
committed
[GENAI] Add tests and fix error
1 parent aefca7d commit 72e602b

11 files changed

Lines changed: 3255 additions & 4 deletions

File tree

.github/workflows/genai-ci-cd.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
run: |
4040
python -m pip install --upgrade pip
4141
pip install -r requirements.txt
42-
pip install pytest pytest-asyncio httpx
4342
4443
- name: Run Python tests
4544
run: |
@@ -61,6 +60,9 @@ jobs:
6160
assert response.status_code == 200
6261
print('Health check test passed')
6362
"
63+
64+
# Run pytest tests
65+
pytest test/ -v --tb=short
6466
6567
build:
6668
name: Build and Push Docker Images

genai/rag.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,11 +701,11 @@ def get_collection_stats(self) -> Dict[str, Any]:
701701

702702
result = {
703703
"collection_name": "recipes",
704-
"total_objects": stats.total,
704+
"total_objects": len(stats),
705705
"status": "healthy"
706706
}
707707

708-
logger.info(f"Retrieved collection statistics in {total_duration}ms: {stats.total} objects")
708+
logger.info(f"Retrieved collection statistics in {total_duration}ms: {len(stats)} objects")
709709
structured_logger.info(
710710
f"Collection statistics retrieval completed",
711711
extra={
@@ -715,7 +715,7 @@ def get_collection_stats(self) -> Dict[str, Any]:
715715
'operation': 'get_collection_stats',
716716
'collection_name': 'recipes',
717717
'status': 'success',
718-
'total_objects': stats.total,
718+
'total_objects': len(stats),
719719
'stats_duration_ms': stats_duration
720720
}
721721
}

genai/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ langchain-huggingface
1212
sentence-transformers
1313
pytest==7.4.3
1414
pytest-asyncio==0.23.2
15+
pytest-cov==4.1.0
16+
pytest-xdist==3.3.1
17+
pytest-mock==3.12.0
1518
httpx==0.27.0
1619
prometheus-fastapi-instrumentator

0 commit comments

Comments
 (0)