From a4fc1fb1bc130fff45f300a77693609e6d751e3a Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 22 Jul 2026 15:47:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E9=9B=86=E6=88=90=E6=B5=8B=E8=AF=95?= =?UTF-8?q?xdist=E9=99=90=E5=88=B6=E4=B8=BA2=E4=B8=AAworker=EF=BC=8C?= =?UTF-8?q?=E9=98=B2=E6=AD=A2DooD=E6=A8=A1=E5=BC=8F=E4=B8=8BOOM=E6=9D=80?= =?UTF-8?q?=E8=BF=9B=E7=A8=8B\n\n-=20=E4=BB=8E=20-n=20auto=20=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=20-n=202\n-=20DooD=E6=A8=A1=E5=BC=8F=E4=B8=8Bnproc?= =?UTF-8?q?=E8=AF=BB=E5=88=B0=E5=AE=BF=E4=B8=BB=E6=9C=BA4=E6=A0=B88?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=3D8worker\n-=20=E6=AF=8F=E4=B8=AAworker?= =?UTF-8?q?=E6=9C=89=E7=8B=AC=E7=AB=8BPG=E5=BA=93+ffmpeg=E7=BC=96=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E5=86=85=E5=AD=98=E5=BC=80=E9=94=80=E5=A4=A7\n-=208wo?= =?UTF-8?q?rker=E7=9B=B4=E6=8E=A5=E8=A7=A6=E5=8F=91OOM=20killer=E6=9D=80ff?= =?UTF-8?q?mpeg=E5=92=8Cworker=E8=BF=9B=E7=A8=8B\n-=202worker=E6=97=A2?= =?UTF-8?q?=E8=83=BD=E6=8F=90=E9=80=9F=EF=BC=88~1.5x=EF=BC=89=E5=8F=88?= =?UTF-8?q?=E7=A8=B3=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ci/run_integration_tests.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 "✅ 集成测试通过"