test: add real environment smoke coverage

This commit is contained in:
hectorzhao
2026-07-01 17:42:19 +08:00
parent bbbbe269a8
commit 7fa91675b8
3 changed files with 313 additions and 5 deletions
+9 -3
View File
@@ -42,22 +42,28 @@ npm --prefix api test -- channels.service.spec.ts
npm --prefix api test -- operations.service.spec.ts
npm run test:api
npm run verify:phase8
npm run build
npm run spike:gateway
npm --prefix api test
npm run test:gateway
node tools/smoke/real-env-smoke.mjs
```
### 当前结果
- API Jest5 个 test suite 通过,21 个测试通过。
- API Jest5 个 test suite 通过,22 个测试通过。
- Gateway`npm run spike:gateway` 通过。
- 阶段 8 完整验证:`npm run verify:phase8` 通过,其中 BullMQ spike 15000 条消息、并发 500、端到端 735.83 TPS,满足 500 TPS。
- 阶段 8 完整验证:`npm run verify:phase8` 通过,其中 BullMQ spike 15000 条消息、并发 500、端到端 705.65 TPS,满足 500 TPS。
- 前端 build 通过,仍存在既有 Vite chunk size warning。
- API 测试均使用 mock,不要求 PostgreSQL/Redis/MinIO 在线。
- 真实 PostgreSQL/Redis/MinIO smoke 通过:
- PostgreSQL `localhost:5432`、Redis `localhost:6379`、MinIO `localhost:9000/9001` 端口均连通。
- `npm --prefix api run prisma:migrate:deploy` 通过,无待应用迁移。
- API 以真实 `.env` 启动,`GET http://127.0.0.1:3101/api/health` 返回 `ok`
- `tools/smoke/real-env-smoke.mjs` 已补充最小幂等 seed,并验证登录、企业/客户、人工充值、余额检查、发送任务、MinIO 预签名上传、运营日志、发送链路追踪和账务对账聚合。
### 已知缺口
- 暂未新增前端测试框架,前端仍以 `npm run build` 作为 smoke。
- 暂未跑真实 PostgreSQL/Redis/MinIO 集成测试。
- BullMQ 真实链路仍由 `npm run spike:bullmq` 覆盖,不在 Jest 内启动 Redis。
- Gateway 未接真实运营商 SMSC;真实 CMPP 互通需要运营商测试环境后补充联调记录。