test: 添加E2E测试基础设施(docker-compose + seed + test)

docker-compose.e2e.yml启动Gitea+assistant;seed.sh自动创建用户/仓库/Webhook/PR;test.sh轮询验证AI评论出现

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
accelerator
2026-03-01 03:46:43 +00:00
parent 20b7fae496
commit 5c0b4808ee
3 changed files with 392 additions and 0 deletions

71
docker-compose.e2e.yml Normal file
View File

@@ -0,0 +1,71 @@
version: '3.8'
# E2E 测试环境Gitea + gitea-assistant
# 用法:
# docker compose -f docker-compose.e2e.yml up -d
# # 等待服务启动后运行 seed 脚本:
# ./e2e/seed.sh
# # 运行 E2E 测试:
# ./e2e/test.sh
# # 清理:
# docker compose -f docker-compose.e2e.yml down -v
services:
gitea:
image: gitea/gitea:1.22
container_name: e2e-gitea
environment:
- GITEA__database__DB_TYPE=sqlite3
- GITEA__server__ROOT_URL=http://gitea:3000
- GITEA__server__HTTP_PORT=3000
- GITEA__security__INSTALL_LOCK=true
- GITEA__service__DISABLE_REGISTRATION=false
- GITEA__service__REQUIRE_SIGNIN_VIEW=false
- GITEA__webhook__ALLOWED_HOST_LIST=*
- GITEA__webhook__SKIP_TLS_VERIFY=true
ports:
- "3333:3000"
volumes:
- gitea-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/v1/version"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
assistant:
build:
context: .
dockerfile: Dockerfile
container_name: e2e-assistant
depends_on:
gitea:
condition: service_healthy
environment:
- NODE_ENV=production
- GITEA_API_URL=http://gitea:3000/api/v1
- GITEA_ACCESS_TOKEN=${E2E_GITEA_TOKEN:-placeholder}
- OPENAI_BASE_URL=${OPENAI_BASE_URL:-https://api.openai.com/v1}
- OPENAI_API_KEY=${OPENAI_API_KEY:-test_key}
- OPENAI_MODEL=${OPENAI_MODEL:-gpt-4o-mini}
- FEISHU_WEBHOOK_URL=http://localhost:9999/noop
- PORT=3000
- WEBHOOK_SECRET=e2e-test-secret
- REVIEW_ENGINE=agent
- REVIEW_WORKDIR=/tmp/e2e-review
- REVIEW_AUTO_PUBLISH_MIN_CONFIDENCE=0.5
- REVIEW_ENABLE_HUMAN_GATE=false
- REVIEW_ALLOWED_COMMANDS=git,rg,cat,sed,wc
- REVIEW_COMMAND_TIMEOUT_MS=30000
ports:
- "3334:3000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
volumes:
gitea-data: