test: use PostgreSQL and live model integrations

This commit is contained in:
2026-09-25 20:30:28 +08:00
parent dd48e13cf2
commit 8bebcdb470
9 changed files with 144 additions and 77 deletions
+32
View File
@@ -13,6 +13,38 @@ services:
retries: 12
redis:
image: redis:7-alpine
test-db:
profiles: [test]
image: pgvector/pgvector:pg16
environment:
POSTGRES_DB: wisegrade_tests
POSTGRES_USER: wisegrade_test
POSTGRES_PASSWORD: wisegrade_test
tmpfs:
- /var/lib/postgresql/data
healthcheck:
test: [CMD-SHELL, "pg_isready -U wisegrade_test -d wisegrade_tests"]
interval: 5s
retries: 12
test:
profiles: [test]
build:
context: ./backend
args:
INCLUDE_DEV: "true"
env_file: .env
environment:
DATABASE_URL: postgresql+psycopg://wisegrade_test:wisegrade_test@test-db:5432/wisegrade_tests
TEST_DATABASE_URL: postgresql+psycopg://wisegrade_test:wisegrade_test@test-db:5432/wisegrade_tests
EMBEDDING_MODEL_PATH: /models/bge-m3
OCR_MODEL_DIR: /models/ocr
volumes:
- ./backend/tests:/app/tests:ro
- ./docs:/docs:ro
- ./models:/models:ro
depends_on:
test-db: {condition: service_healthy}
command: ["pytest", "-q"]
api:
build: ./backend
env_file: .env