All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 49s
- NEW test/helpers/mock-ai-provider.ts: Mock AI HTTP server with normal/timeout/429/500/invalid-json behavior controls - NEW test/helpers/integration-harness.ts: spawn real API/Worker processes, HTTP helpers, PrismaClient-based DB helpers - NEW test/m-ai-01-09.worker-int-spec.ts: real integration test using actual MySQL/Redis/BullMQ/HTTP (Active Recall, Feynman, Document Import, SIGKILL recovery, provider faults, idempotency) - NEW test/jest-worker-integration.json: Jest config with NO mocks - DELETE test/m-ai-01-09.e2e-spec.ts: removed mock-based pseudo-e2e - UPDATE test/run-integration-ci.sh: uses real integration config - UPDATE package.json: test:integration:worker uses real config Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
42 lines
1.1 KiB
Bash
42 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# M-AI-01-09 真实集成测试 CI Runner
|
|
# 启动真实 MySQL/Redis/API/Worker/Mock AI Provider 并执行集成测试
|
|
set -e
|
|
|
|
echo "=== M-AI-01-09 真实集成测试 ==="
|
|
|
|
DB_URL="${DATABASE_URL:-mysql://zhixi_user:test@127.0.0.1:3306/zhixi_test}"
|
|
REDIS_H="${REDIS_HOST:-127.0.0.1}"
|
|
REDIS_P="${REDIS_PORT:-6379}"
|
|
REDIS_PW="${REDIS_PASSWORD:-}"
|
|
|
|
# 1. Check MySQL
|
|
echo "[1/7] Checking MySQL..."
|
|
mysqladmin ping -h "${REDIS_H}" -u root -p"${MYSQL_ROOT_PASSWORD:-root}" --silent 2>/dev/null || {
|
|
echo "MySQL not reachable; ensure MySQL is running"
|
|
exit 1
|
|
}
|
|
|
|
# 2. Prisma migration
|
|
echo "[2/7] Running Prisma migration..."
|
|
npx prisma migrate deploy
|
|
|
|
# 3. Build
|
|
echo "[3/7] Building..."
|
|
npm run build --if-present
|
|
|
|
# 4. Start Mock AI Provider is handled internally by the test
|
|
# 5. Run integration tests (test starts its own API/Worker/Mock Provider)
|
|
echo "[4/7] Running real integration tests..."
|
|
npx jest --config test/jest-worker-integration.json --forceExit --verbose 2>&1
|
|
TEST_EXIT=$?
|
|
|
|
echo ""
|
|
if [ $TEST_EXIT -eq 0 ]; then
|
|
echo "=== M-AI-01-09: PASS ==="
|
|
else
|
|
echo "=== M-AI-01-09: FAIL ==="
|
|
fi
|
|
|
|
exit $TEST_EXIT
|