🧪 Playbook 测试套件
本目录包含 Playbook 项目的可执行行为测试。
📋 目录结构
test/
├── README.md # 本文件:测试文档
├── test_commit_message_policy.py # 提交信息校验器和 CI 委托行为
├── test_gitea_fetch_ci_logs.py # Gitea CI 日志采集行为
├── test_main_loop_cli.py # ticket 调度、隔离、证据与集成测试
├── test_main_loop_scheduler.py # 全局调度器和依赖图行为
├── test_playbook.py # snapshot/subtree 参数化完整部署测试
├── test_thirdparty_skills_pipeline.py # thirdparty skills 流水线配置与同步行为
├── test_tsl_api_framework.py # TSL API 索引和 Framework Profile 行为
├── test_tsl_playbook_sync.py # TSL Playbook 构建与同步行为
└── integration/ # 文档完整性检查
└── check_doc_links.py # 本地 Markdown 链接目标检查
🚀 快速开始
# 进入 playbook 根目录
cd /path/to/playbook
# 运行 Python 测试(test/ 下的 test_*.py)
python -X utf8 -B -m unittest discover -s test -p "test_*.py" -v
# 文档链接检查
python test/integration/check_doc_links.py
🧭 CI 自动化测试
测试套件通过 Gitea Actions 自动运行(见 .gitea/workflows/checks.yml 的 tests job):
- 触发方式:
workflow_run——「🧰 准备环境」(prepare.yml)完成后触发。 Prepare 监听push:main、pull_request、workflow_dispatch与每日schedule, 故推送到 main、对 main 开 PR 或手动运行 Prepare 都会经 Prepare 传导到测试。 - 运行平台:standard-ubuntu-22
- 注:
checks.yml同时包含 commit message 规范校验(standardsjob)。
📚 测试详解
1. Playbook 部署测试 (test_playbook.py)
使用同一个完整 playbook.toml 参数化验证:
- snapshot 与 subtree 两种安装模式
- rules、memory bank、prompts、standards 和 skills 同步
- 重复执行的幂等性与自定义文件保留
2. 主循环测试 (test_main_loop_cli.py)
使用临时 Git 仓库验证 ticket 队列、串行与 worktree 隔离、并发 claim、heartbeat/reclaim、 验证与 review 证据绑定,以及 ticket/feature 两级集成。
3. TSL 和同步行为测试
test_tsl_api_framework.py:验证 API 索引、class 查询和 Framework Profile 行为test_tsl_playbook_sync.py:验证 TSL Playbook 构建和同步文件边界test_thirdparty_skills_pipeline.py:验证 thirdparty manifest、workflow 和同步产物
4. 文档链接检查 (integration/)
扫描仓库中的 Markdown 文件,确保本地文档引用的目标路径有效。