调整lsfx mock上传流水条数范围

This commit is contained in:
wkc
2026-03-19 15:23:44 +08:00
parent f06ae4a9bf
commit 8ff6570ba8
3 changed files with 59 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
# lsfx-mock-server 上传流水条数范围调整实施记录
## 修改目标
-`lsfx-mock-server` 上传文件接口生成的 `totalRecords` 随机范围调整为 `150-200`
- 保持改动只影响上传链路,不扩散到其他非上传接口
## 修改内容
- 修改 `lsfx-mock-server/services/file_service.py`
- `upload_file()` 中创建 `FileRecord` 时的 `total_records` 生成逻辑
-`random.randint(100, 300)` 调整为 `random.randint(150, 200)`
- 修改 `lsfx-mock-server/tests/test_file_service.py`
- 新增上传文件 `totalRecords` 范围测试
- 通过定向劫持旧区间 `random.randint(100, 300)` 返回 `300`,确保旧实现先失败,再验证新实现通过
## 验证记录
- 执行 `python3 -m pytest tests/test_file_service.py -k total_records_range -q`
- 首次执行结果: 失败,旧实现返回 `300`
- 修改后预期: 测试通过,上传文件返回的 `totalRecords` 落在 `150-200`
## 影响范围
- 影响接口: `POST /watson/api/project/remoteUploadSplitFile`
- 关联链路:
- 上传接口响应中的 `uploadLogList[].totalRecords`
- 后续通过真实 `file_records` 读取上传状态时返回的 `logs[].totalRecords`
- 不影响:
- 行内流水拉取接口
- 无真实记录时的 deterministic 回退数据