Skip to content

fix: 修复单测以适配 vectordb 接口重构,统一测试数据路径#333

Merged
MaojiaSheng merged 1 commit intomainfrom
fix/unit-tests
Feb 27, 2026
Merged

fix: 修复单测以适配 vectordb 接口重构,统一测试数据路径#333
MaojiaSheng merged 1 commit intomainfrom
fix/unit-tests

Conversation

@qin-ctx
Copy link
Collaborator

@qin-ctx qin-ctx commented Feb 27, 2026

概要

  • 修复多处代码以适配 Feat/vectordb interface refactor #327 vectordb 接口重构后的单测失败
  • 统一所有测试数据路径至 test_data/ 目录,清理 .gitignore 中的散落条目
  • 修复若干运行时边界问题(filesystem stat 错误匹配、queue manager 未初始化、HTTP client 关闭异常)

改动内容

  • openviking/server/routers/filesystem.py: stat 错误匹配增加 "not found" 判断
  • openviking/server/routers/resources.py: 为 AddResourceRequest 添加 model_validator 校验
  • openviking/service/debug_service.py: 处理 queue manager 未初始化时的异常
  • openviking/storage/collection_schemas.py: 简化 record ID 生成,移除 owner_space
  • openviking_cli/client/http.py: 捕获 aclose()RuntimeError
  • tests/: 统一测试数据路径至 test_data/,适配 get_context_by_uri() 等新接口,移除 VikingDBInterface mock 依赖

测试计划

  • 运行 pytest tests/ 验证所有单测通过
  • 确认 test_data/ 目录在测试运行后正确生成和清理

close #326

🤖 Generated with Claude Code

- 修复 filesystem stat 错误匹配,增加 "not found" 判断
- 为 AddResourceRequest 添加 model_validator 校验 path 参数
- 处理 queue manager 未初始化时 ObserverService 的异常
- 简化 vectordb record ID 生成逻辑,移除 owner_space
- 捕获 HTTP client close 时的 RuntimeError
- 统一测试数据路径至 test_data/ 目录
- 更新测试用例使用 get_context_by_uri() 等新接口
- 移除测试 mock 对 VikingDBInterface 的依赖

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@MaojiaSheng MaojiaSheng merged commit 8274cc3 into main Feb 27, 2026
4 of 6 checks passed
@MaojiaSheng MaojiaSheng deleted the fix/unit-tests branch February 27, 2026 11:40
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] 多个测试失败:4 个生产代码 bug 和 5 个测试代码 bug

4 participants