fix(ci): B5 整合測試 DinD 修正 — 用 host bridge IP + published port
Some checks failed
CD Pipeline / build-and-deploy (push) Failing after 2m2s

DinD 環境下 volume mount 和 compose 網路都不可靠:
- runner container 的路徑 ≠ host 路徑 (volume 失敗)
- compose 網路 IP 對 runner 不可路由

解法: host docker bridge (ip route default gateway) + postgres exposed port 15432
runner 直接用 /opt/api-venv/bin/pytest (host runner 上已安裝)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-10 13:03:25 +08:00
parent c8b5c994d4
commit e65d931e73
2 changed files with 15 additions and 8 deletions

View File

@@ -17,9 +17,6 @@ services:
POSTGRES_PASSWORD: awoooi_test_2026
ports:
- "15432:5432"
# 啟動時自動執行 setup_test_schema.sql (initdb.d 機制)
volumes:
- ./tests/integration/setup_test_schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U awoooi -d awoooi_test"]
interval: 5s
@@ -40,6 +37,7 @@ services:
# 2026-04-10 Claude Sonnet 4.6 Asia/Taipei: 整合測試 runner
# 在 compose 網路內跑 pytesthostname=postgres-test 直連,不依賴 host venv
# Schema 由 CD workflow 用 compose exec psql 初始化(避免 DinD volume 路徑問題)
pytest-runner:
image: python:3.11-slim
working_dir: /workspace