Files
awoooi/apps/api/docker-compose.test.yml
OG T 49bfbd573c
Some checks failed
CD Pipeline / build-and-deploy (push) Failing after 2m34s
feat(test): B5 整合測試框架 — 真實 DB, 5/5 通過
新增:
- docker-compose.test.yml: CI 用臨時 pgvector PostgreSQL (port 15432)
- tests/factories.py: Incident/Approval/Knowledge/RAG 測試資料工廠
- tests/integration/test_b5_core_flows.py: 5 個 E2E 整合測試 (5/5 PASSED 1.03s)
- tests/integration/setup_test_schema.sql: CI schema 初始化 SQL
- cd.yaml: 新增 Integration Tests B5 step
- scripts/sync_dev_db.py: dev DB 同步工具

修正:
- .env.test: DATABASE_URL 指向 awoooi_dev (本機設定, gitignore 不入庫)

禁止 Mock 鐵律: 所有 DB 測試使用真實 PostgreSQL, 無 SQLite/MagicMock

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 11:22:57 +08:00

37 lines
941 B
YAML

# AWOOOI 整合測試用 Docker Compose
# ===================================
# 用途: CI 環境中提供完全隔離的 PostgreSQL + Redis
# 不用於生產環境
#
# 啟動: docker compose -f docker-compose.test.yml up -d
# 停止: docker compose -f docker-compose.test.yml down -v
#
# 2026-04-10 Claude Sonnet 4.6 Asia/Taipei
services:
postgres-test:
image: pgvector/pgvector:pg16
environment:
POSTGRES_DB: awoooi_test
POSTGRES_USER: awoooi
POSTGRES_PASSWORD: awoooi_test_2026
ports:
- "15432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U awoooi -d awoooi_test"]
interval: 5s
timeout: 3s
retries: 10
tmpfs:
- /var/lib/postgresql/data # 記憶體內 — 快 + 隔離
redis-test:
image: redis:7-alpine
ports:
- "16380:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5