refactor(test): 重构测试套件结构并优化测试配置
feat(test-suite): 新增测试套件模块,包含API测试客户端和测试配置 fix(api): 修复数据库实体和仓库的删除操作返回值 style(api): 统一数据库表名和字段命名 perf(api): 添加缓存注解提升配置查询性能 test(api): 添加H2测试数据库配置支持 chore: 清理旧的测试文件和脚本
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
# Woodpecker CI/CD 配置 - E2E/UAT测试集成
|
||||
# 集成Python pytest测试套件
|
||||
|
||||
pipeline:
|
||||
# E2E/UAT测试阶段
|
||||
test-e2e-uat:
|
||||
image: python:3.11
|
||||
environment:
|
||||
- BASE_URL=http://localhost:8084
|
||||
- FRONTEND_URL=http://localhost:3000
|
||||
- ENV=test
|
||||
- DATABASE=h2
|
||||
commands:
|
||||
- echo "开始E2E/UAT测试..."
|
||||
- cd test-suite
|
||||
- pip install -r requirements.txt
|
||||
- pip install pytest-xdist pytest-rerunfailures
|
||||
- python3 run_tests.py --parallel --reruns 2 --coverage
|
||||
- echo "✅ E2E/UAT测试完成"
|
||||
when:
|
||||
event: [push, pull_request]
|
||||
|
||||
# 生成测试报告
|
||||
generate-report:
|
||||
image: python:3.11
|
||||
commands:
|
||||
- echo "生成测试报告..."
|
||||
- cd test-suite
|
||||
- pip install -r requirements.txt
|
||||
- pip install allure-pytest
|
||||
- pytest tests/ --alluredir=allure-results
|
||||
- echo "✅ 报告生成完成"
|
||||
when:
|
||||
event: [push, pull_request]
|
||||
|
||||
# 质量门禁
|
||||
quality-gates:
|
||||
image: python:3.11
|
||||
commands:
|
||||
- echo "开始质量门禁检查..."
|
||||
- cd test-suite
|
||||
- pip install -r requirements.txt
|
||||
- pytest tests/ --cov=. --cov-report=term-missing --cov-fail-under=80
|
||||
- echo "✅ 质量门禁检查通过"
|
||||
when:
|
||||
event: [pull_request]
|
||||
|
||||
# 工作流配置
|
||||
workflows:
|
||||
# 开发分支工作流
|
||||
develop:
|
||||
when:
|
||||
event: [push]
|
||||
branch: [develop]
|
||||
steps:
|
||||
- test-e2e-uat
|
||||
- generate-report
|
||||
|
||||
# 主分支工作流
|
||||
main:
|
||||
when:
|
||||
event: [push]
|
||||
branch: [main]
|
||||
steps:
|
||||
- test-e2e-uat
|
||||
- quality-gates
|
||||
- generate-report
|
||||
|
||||
# Pull Request工作流
|
||||
pull-request:
|
||||
when:
|
||||
event: [pull_request]
|
||||
steps:
|
||||
- test-e2e-uat
|
||||
- quality-gates
|
||||
|
||||
# 通知配置
|
||||
notifications:
|
||||
slack:
|
||||
webhook: ${SLACK_WEBHOOK_URL}
|
||||
channel: '#ci-cd'
|
||||
on_success: true
|
||||
on_failure: true
|
||||
|
||||
# 环境变量
|
||||
environment:
|
||||
- PYTHONUNBUFFERED=1
|
||||
- PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
# 缓存配置
|
||||
cache:
|
||||
paths:
|
||||
- ~/.pip/cache
|
||||
- test-suite/.pytest_cache
|
||||
Reference in New Issue
Block a user