docs(p0-5): 集成测试命令补上 -p 1

三个包的 MySQL fixture 都对同一个 schema 做 DROP 加 AutoMigrate。
包级并行会互相踩踏:`Error 1050 Table already exists` 与 `Error 1146 doesn't exist`。
因此 §9.2 的命令必须带 `-p 1`,原样执行会失败。

`AGENTS.md` 的 Integration tests 段同步写明这条约束。

验证:`go test -tags integration -p 1 -count=1 ./internal/video/ ./internal/feed/ ./internal/worker/` 全绿。
This commit is contained in:
2026-11-01 15:40:02 +08:00
parent a0bd798d8a
commit eda8237c36
2 changed files with 5 additions and 1 deletions

View File

@@ -234,6 +234,8 @@ go test -tags integration -count=1 -timeout 300s -v ./internal/middleware/rabbit
Configure endpoints through env vars (`RABBITMQ_TEST_URL`, …), never hardcoded hosts. When a prerequisite is missing — a restart command, a delete-queue command — `t.Skip` with the reason; a silent pass is not a substitute for a skip.
The MySQL fixtures each `DropTable` + `AutoMigrate` the shared schema, so run more than one such package at a time with `-p 1`. Without it the packages run in parallel and drop each other's tables (`Error 1050 Table already exists`, `Error 1146 doesn't exist`).
### Determinism and speed
- No real network in unit tests; no `time.Sleep` as synchronization. Prefer channels, context deadlines, or an injected clock. Tests must pass under `-race` and in any order.

View File

@@ -1704,7 +1704,9 @@ go test -race -count=1 ./...
# 需要 MySQL 的部分(compose 起 mysql 后)
docker compose -f ../docker-compose.yml up -d mysql
go test -tags integration -count=1 -timeout 300s ./internal/video/ ./internal/feed/ ./internal/worker/
# -p 1 不能省:三个包的 fixture 都对同一个 schema 做 DROP + AutoMigrate,
# 包级并行会互相踩踏(Error 1050 Table already exists / Error 1146 doesn't exist)。
go test -tags integration -p 1 -count=1 -timeout 300s ./internal/video/ ./internal/feed/ ./internal/worker/
# 前端不受影响,但类型定义有可选字段变更,仍跑一次构建
cd ../frontend && npm run build