test: server 测试共用建库与假引擎,sse-pg 归入串行组

- 新增 apps/server/test/support/{pg,engine}.ts:测试库地址、可用性探测、schema 咨询锁、
  建 schema + 加锁迁移 + 删除、可选去重的假引擎;6 份 harness 改用它(acquisition-organize 与
  file-manager 原先迁移不加锁,并行下有冲突隐患,一并修正)
- sse-pg 起子进程,并行下子进程启动超时,归入 serial
- 修正 b61335e 挪动 / 改名测试后遗留的 import 排序与格式(当时 lint 检查经管道被吞掉退出码)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-10-02 17:40:43 +08:00
1 parent 7cc3742d31
commit c9e8120fc6
25 files changed
+254 -328

No files matched your search

+2 -1
View File
@@ -5,7 +5,7 @@ import { defineConfig } from "vitest/config";
// pg —— 真实 PG、假引擎(每文件独立 schema),文件并行;
// serial —— 起真实引擎 / worker / 后台循环 / 子进程的集成与 e2e,文件级串行。并发跑时 worker、轮询、迁移
// 互相抢 CPU 与连接,会把"入库→状态推进"这类时序拉长到超时,串行让每个文件拿到稳定的时序预算。
// 新测试缺省进 pg;起真实 worker / 引擎的加进 SERIAL;确认不碰 PG 的加进 UNIT。
// 新测试缺省进 pg;起真实 worker / 引擎 / 子进程的加进 SERIAL;确认不碰 PG 的加进 UNIT。
// 并行文件数受开发库连接数约束(max_connections 100,每个 harness 连接池 5–10):MAX_WORKERS 别随手调大。
const UNIT = [
"test/api-registry.test.ts",
@@ -27,6 +27,7 @@ const SERIAL = [
"test/e2e/**/*.test.ts",
"test/auth-settings/admin-api.test.ts",
"test/auth-settings/engine-retry.test.ts",
"test/auth-settings/sse-pg.test.ts",
"test/system/**/*.test.ts",
"test/search/search.test.ts",
"test/search/two-stage-search.test.ts",