docs(plan): test suite command uses -p 1 (shared-PG destructive fixtures race)
This commit is contained in:
@@ -3155,7 +3155,7 @@ func (a *api) scanLibrary(c *gin.Context) {
|
||||
|
||||
- [ ] **Step 5: 跑全部后端测试确认通过;Commit**
|
||||
|
||||
Run: `cd backend && DATABASE_URL=... REDIS_URL=... go test ./... -v`
|
||||
Run: `cd backend && DATABASE_URL=... REDIS_URL=... go test -p 1 ./... -v`
|
||||
Expected: 全 PASS
|
||||
|
||||
```bash
|
||||
@@ -4166,12 +4166,12 @@ func dbErr(c *gin.Context, e error) {
|
||||
}
|
||||
```
|
||||
|
||||
把所有 handler 中 `"internal", "db error"` 的 500 分支替换为 `dbErr(c, <该处的 error 变量>)`:auth.go(login 1 处)、users.go(listUsers/createUser/deleteUser 各 1 处)、libraries.go(listLibraries)、books.go(listBooks/deleteBook)、content.go 无 DB 500 分支、progress.go(putProgress/listProgress)。替换后 `go test ./...` 全绿即可(既有测试不覆盖 PG 宕机路径)。
|
||||
把所有 handler 中 `"internal", "db error"` 的 500 分支替换为 `dbErr(c, <该处的 error 变量>)`:auth.go(login 1 处)、users.go(listUsers/createUser/deleteUser 各 1 处)、libraries.go(listLibraries)、books.go(listBooks/deleteBook)、content.go 无 DB 500 分支、progress.go(putProgress/listProgress)。替换后 `go test -p 1 ./...` 全绿即可(既有测试不覆盖 PG 宕机路径)。
|
||||
|
||||
- [ ] **Step 4: 全量回归 + 本地起服烟测**
|
||||
|
||||
```bash
|
||||
cd backend && go vet ./... && DATABASE_URL=postgres://lib:lib@localhost:5433/lib?sslmode=disable REDIS_URL=redis://localhost:6380 go test ./...
|
||||
cd backend && go vet ./... && DATABASE_URL=postgres://lib:lib@localhost:5433/lib?sslmode=disable REDIS_URL=redis://localhost:6380 go test -p 1 ./...
|
||||
mkdir -p /tmp/libtest/books/demo && echo hello > /tmp/libtest/books/demo/a.txt
|
||||
cd backend && JWT_SECRET=devsecret DATABASE_URL=postgres://lib:lib@localhost:5433/lib?sslmode=disable \
|
||||
REDIS_URL=redis://localhost:6380 ADMIN_USER=admin ADMIN_PASSWORD=adminpw12 BOOKS_DIR=/tmp/libtest/books \
|
||||
|
||||
Reference in New Issue
Block a user