Commit ebf3a3994cbdebb2f800f33c6dab7bca83dab71d
1 parent
282a5243
chore(usr): record test-gate attempt r1 GREEN evidence (JDK17 toolchain, 125 tests pass)
Showing
1 changed file
with
53 additions
and
0 deletions
docs/superpowers/module-reports/usr-test-gate-r1.md
0 → 100644
| 1 | +# usr 模块硬测试闸 —— attempt r1(GREEN) | |
| 2 | + | |
| 3 | +- **模块**: usr(用户/认证) | |
| 4 | +- **阶段**: backend test-gate(合并默认分支前的硬测试闸) | |
| 5 | +- **attempt**: r1 | |
| 6 | +- **判定**: ✅ **GREEN** | |
| 7 | +- **执行时间**: 2026-06-01 15:56–15:57 CST | |
| 8 | +- **执行命令**: `node scripts/test.mjs`(内部 `ensureJava17()` 固定 JDK17 后逐级执行 setup-db → build → lint → unit+integration → e2e) | |
| 9 | +- **功能分支 HEAD**: `282a524`(`chore(usr): 移除 JDK25 工具链导致的过期红色 test-gate 证据 r1-r5`) | |
| 10 | + | |
| 11 | +## 背景:根因与修复 | |
| 12 | + | |
| 13 | +历史上 usr 模块在 JDK25 默认工具链下连续 5 次 RED(旧 r1–r5 证据),根因为: | |
| 14 | + | |
| 15 | +- Maven Surefire fork 出的测试 JVM 沿用开发机默认 JDK(**Java 25**,class file 版本 69)。 | |
| 16 | +- Mockito 自带的 Byte Buddy 不支持过新的 class file 版本(仅到 Java 22 = 66),导致 `UsrAuthServiceImplTest.setUp` 阶段对 `com.xly.erp.common.security.JwtUtil` 整片 `Mockito cannot mock this class` 报 error。 | |
| 17 | +- 旧 r5 终态:`Tests run: 88, Failures: 0, Errors: 9, Skipped: 0`(9 个 error 全部来自 Mockito mock 失败)。 | |
| 18 | + | |
| 19 | +修复(已在功能分支落地): | |
| 20 | + | |
| 21 | +- `dbc3454 chore(infra): test.mjs 固定后端测试 JDK 为 Java 17` —— `scripts/test.mjs` 新增 `ensureJava17()`,在跑后端 Maven 前把进程树 `JAVA_HOME`/`PATH` 固定到 Java 17 运行时(不改全局 profile)。 | |
| 22 | +- `282a524 chore(usr): 移除 JDK25 工具链导致的过期红色 test-gate 证据 r1-r5` —— 移除过期红色证据,避免污染报告前置判定。 | |
| 23 | + | |
| 24 | +本次 r1 是修复落地后在 **JDK17 工具链**下的首次重跑。 | |
| 25 | + | |
| 26 | +## 工具链确认 | |
| 27 | + | |
| 28 | +- `/usr/libexec/java_home -v 17` → `/opt/homebrew/Cellar/openjdk@17/17.0.19/libexec/openjdk.jdk/Contents/Home` | |
| 29 | +- `ensureJava17()` 日志:`[test.mjs] 固定 JAVA_HOME=Java 17 → /opt/homebrew/Cellar/openjdk@17/17.0.19/libexec/openjdk.jdk/Contents/Home` | |
| 30 | +- Spring Boot 测试启动日志确认运行时:`Starting ErpApplicationTests using Java 17.0.19` | |
| 31 | +- Maven:Apache Maven 3.9.15 / Java version 17.0.19 | |
| 32 | + | |
| 33 | +## 5 级闸门执行结果 | |
| 34 | + | |
| 35 | +| 阶段 | 命令 | 结果 | | |
| 36 | +|-----|------|------| | |
| 37 | +| 1/5 setup test db | `node scripts/setup-test-db.mjs`(DROP+CREATE `xlyweberp_vibe_erp_test`,schema 由 Flyway 启动时 apply) | ✅ done | | |
| 38 | +| 2/5 build | `mvn -q -B -DskipTests package` | ✅ pass | | |
| 39 | +| 3/5 lint | `mvn -q -B checkstyle:check` | ✅ pass | | |
| 40 | +| 4/5 unit + integration | `mvn -q -B test` | ✅ pass | | |
| 41 | +| 5/5 e2e | 后端无 e2e(前端阶段单独执行) | ✅ skip(按 docs/04 §零约定) | | |
| 42 | + | |
| 43 | +退出码:`0`;test.mjs 终态输出:`[test.mjs] GREEN`。 | |
| 44 | + | |
| 45 | +## 测试统计(surefire-reports 汇总) | |
| 46 | + | |
| 47 | +- **总计**:`Tests run: 125, Failures: 0, Errors: 0, Skipped: 0`(25 个测试类)。 | |
| 48 | +- 关键回归:曾整片报错的 `UsrAuthServiceImplTest`(含 `JwtUtil` mock)本次 **9/9 全绿**,证明 Byte Buddy×JDK25 根因已消除。 | |
| 49 | +- 各 IT(`UsrLoginIT` 12、`UsrUserQueryIT` 13、`UsrUserUpdateIT` 6、`UsrUserCreateIT` 5、`AuthLoginConfigIT` 1)全部通过。 | |
| 50 | + | |
| 51 | +## 结论 | |
| 52 | + | |
| 53 | +usr 模块硬测试闸 r1 = **GREEN**。无 flake(本次为修复后首跑即绿;历史 RED 证据已随旧工具链一并移除,非本轮 attempt 序列)。报告阶段前置(末次 attempt green)已满足。 | ... | ... |