diff --git a/scripts/ci/run_integration_tests.sh b/scripts/ci/run_integration_tests.sh index 9f7975478..279894895 100755 --- a/scripts/ci/run_integration_tests.sh +++ b/scripts/ci/run_integration_tests.sh @@ -252,13 +252,15 @@ echo "=== 运行集成测试(pytest-xdist 并行模式) ===" echo "CPU 核数: $(nproc 2>/dev/null || echo 'unknown')" # 集成测试使用 pytest-xdist 并行加速(coverage 由单元测试负责,并行模式下 coverage 不稳定) -# -n auto: 自动使用 CPU 核数 +# -n 2: 限制2个worker,避免DooD模式下读到宿主机全部核数导致OOM +# 集成测试涉及ffmpeg编码+PG多库,内存开销大,2worker较稳妥 +# (auto模式下读到宿主机4核8线程=8worker,OOM直接杀worker进程) # --dist loadfile: 同一测试文件分配到同一 worker(共享 fixture 更高效) # --maxfail=1: 遇到失败停止调度新测试(并行模式下等价于 -x) PYTHONPATH="$PWD/apps/api:$PWD" python3 -m pytest tests/integration \ -q --timeout=60 --maxfail=1 --reruns 2 --reruns-delay 1 \ -m "not performance" \ - -n auto --dist loadfile \ + -n 2 --dist loadfile \ -p no:cacheprovider echo "✅ 集成测试通过"