Files
ccdi/docs/tests/records/2026-03-22-lsfx-rule-hit-mode-backend-verification.md

42 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# LSFX Mock 规则命中模式后端验证记录
## 执行命令
```bash
cd lsfx-mock-server
python3 -m pytest tests/test_startup.py tests/test_file_service.py -k "rule_hit_plan or parse_args" -v
PORT=18000 python3 main.py --rule-hit-mode all > /tmp/lsfx_main_18000.log 2>&1 &
sleep 3
kill <main-pid>
PORT=18001 python3 dev.py --reload --rule-hit-mode all > /tmp/lsfx_dev_18001.log 2>&1 &
sleep 5
kill <dev-pid>
```
## 测试结果
- 2026-03-22 执行:
`python3 -m pytest tests/test_startup.py tests/test_file_service.py -k "rule_hit_plan or parse_args" -v`
- 结果:`10 passed, 5 deselected, 1 warning in 0.27s`
- warning 为现有 `pydantic` 弃用提示,本次改动未引入失败或 error。
## 启动验证结果
- 普通启动验证:
- 使用临时端口 `18000` 执行 `python3 main.py --rule-hit-mode all`
- 日志显示 `Uvicorn running on http://0.0.0.0:18000`
- 结束后日志显示正常 shutdown进程已清理
- 热重载启动验证:
- 使用临时端口 `18001` 执行 `python3 dev.py --reload --rule-hit-mode all`
- 日志显示 reloader 进程与 server 进程均成功启动
- 结束后日志显示 server process 与 reloader process 已停止
## 进程清理结果
- 启动验证结束后,针对本次工作树路径再次执行进程扫描。
- `main.py --rule-hit-mode all` 无残留进程。
- `dev.py --reload --rule-hit-mode all` 无残留进程。
## 说明
- 原计划默认使用 `8000` 端口进行烟测。
- 验证时发现本机已有独立 `Python main.py` 进程占用 `8000`,为避免影响现有环境,本次改用临时端口 `18000/18001` 完成等价验证。