Skip to content

fix(test): 修复测试稳定性问题,清理废弃代码#353

Merged
qin-ctx merged 2 commits intomainfrom
fix/test-stability-and-cleanup
Feb 28, 2026
Merged

fix(test): 修复测试稳定性问题,清理废弃代码#353
qin-ctx merged 2 commits intomainfrom
fix/test-stability-and-cleanup

Conversation

@qin-ctx
Copy link
Collaborator

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

概述

  • 修复多个测试用例因数据冲突和环境残留导致的不稳定问题
  • 重构 is_closing 为基类正式 property,消除防御性 getattr 调用
  • 清理废弃的 CompressManager 测试,修正路径遍历安全断言
  • 改进 AGFS 库路径发现逻辑和 CLI 服务器启动错误处理

变更内容

重构

  • VikingVectorIndexBackend 基类新增 is_closing property(默认返回 False
  • collection_schemas.pygetattr(self._vikingdb, "is_closing", False) 改为直接属性访问

测试修复

  • test_admin_api.py / test_api_key_manager.py / test_auth.py:每个测试用例使用 uuid 生成唯一 account ID,避免跨测试冲突
  • tests/server/conftest.pytemp_dir fixture 使用唯一子目录,避免并发测试目录竞争
  • tests/misc/test_port_check.py:在断言前先清理历史 ResourceWarning,修复误报
  • tests/agfs/test_fs_binding.py:确保测试目录存在
  • tests/cli/test_cli.py:修复 grep 命令参数顺序
  • tests/cli/conftest.py:统一使用 workspace 配置,改进服务器启动失败时的错误输出

清理

  • 移除已废弃的 TestCompressionEdgeCases 测试类及 CompressManager 导入
  • 路径遍历测试改为断言 ValueError 异常

依赖

  • pyproject.toml 新增 ragas>=0.1.0datasets>=2.0.0pandas>=2.0.0 测试依赖

AGFS SDK

  • binding_client.py 改进 AGFS_LIB_PATH 环境变量处理:支持指向文件或目录

测试计划

  • 运行 pytest tests/server -v 验证服务器测试隔离性
  • 运行 pytest tests/cli -v 验证 CLI 测试
  • 运行 pytest tests/misc -v 验证端口检测测试稳定性
  • 运行 pytest tests/test_edge_cases.py -v 验证边界用例
  • 确认全量测试 pytest 通过

🤖 Generated with Claude Code

- 重构 is_closing 为基类正式 property,移除 getattr 防御性调用
- 测试用例使用唯一 account ID 避免跨测试数据冲突
- 服务器测试使用独立临时目录避免并发竞争
- 修复 ResourceWarning 测试因历史警告导致的误报
- 修复 CLI grep 命令参数顺序
- 更新路径遍历测试断言为 ValueError
- 移除已废弃的 CompressManager 测试
- 改进 AGFS_LIB_PATH 环境变量路径发现逻辑
- 新增 ragas/datasets/pandas 测试依赖
- 改进 CLI 服务器启动失败时的错误输出

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@qin-ctx qin-ctx merged commit 4d7d222 into main Feb 28, 2026
21 checks passed
@qin-ctx qin-ctx deleted the fix/test-stability-and-cleanup branch February 28, 2026 09:04
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Feb 28, 2026
@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.

1 similar comment
@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.

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.

3 participants