♻️ refactor(test): consolidate repository checks

This commit is contained in:
csh
2026-07-20 09:08:36 +08:00
parent 10ce779b1b
commit ff07c79818
24 changed files with 426 additions and 4596 deletions
+11 -24
View File
@@ -7,20 +7,13 @@
```txt
test/
├── README.md # 本文件:测试文档
├── test_gitea_workflow_bootstrap.py # Gitea workflow 自举顺序回归测试
├── test_playbook_config_actions.py # playbook.toml 驱动的同步/部署行为测试
├── test_playbook_toml_parser.py # TOML parser/load_config 边界测试
├── test_playbook.py # snapshot/subtree 参数化完整部署测试
├── test_template_contracts.py # 模板内容、占位符、文案契约测试
├── test_main_loop_cli.py # main_loop CLI 测试
├── agent/ # Agent 题面/运行时验证测试定义
├── test_thirdparty_skills_pipeline.py # thirdparty skills 流水线配置与同步产物测试
├── templates/ # 模板验证测试
│ ├── validate_python_templates.sh # Python 模板验证
│ ├── validate_cpp_templates.sh # C++ 模板验证
│ ├── validate_ci_templates.sh # CI 模板验证
│ └── validate_project_templates.sh # 项目模板验证
└── integration/ # 集成测试
└── check_doc_links.sh # 文档链接有效性检查
└── check_doc_links.py # 文档链接有效性检查
```
## 🚀 快速开始
@@ -32,14 +25,8 @@ cd /path/to/playbook
# 1. 运行 Python 测试(test/ 下的 test_*.py
python -m unittest discover -s test -p "test_*.py" -v
# 2. 运行模板验证测试
sh test/templates/validate_python_templates.sh
sh test/templates/validate_cpp_templates.sh
sh test/templates/validate_ci_templates.sh
sh test/templates/validate_project_templates.sh
# 3. 运行文档链接检查
sh test/integration/check_doc_links.sh
# 2. 运行文档链接检查
python test/integration/check_doc_links.py
```
## 🧭 CI 自动化测试
@@ -54,17 +41,17 @@ sh test/integration/check_doc_links.sh
## 📚 测试详解
### 1. Python CLI 测试 (cli/)
### 1. Playbook 部署测试 (`test_playbook.py`)
使用 `unittest` 运行,覆盖 `scripts/playbook.py` 的核心行为
使用同一个完整 `playbook.toml` 参数化验证
- CLI 参数解析与帮助信息
- TOML 配置解析与动作顺序
- snapshot install/sync_rules/sync_memory_bank/sync_prompts/sync_standards 等基础动作落地
- snapshot 与 subtree 两种安装模式
- rules、memory bank、prompts、standards 和 skills 同步
- 重复执行的幂等性与自定义文件保留
### 2. 模板验证测试 (templates/)
### 2. 模板合同测试 (`test_template_contracts.py`)
通过脚本检查各类模板文件结构与关键字段(如占位符、关键配置项)
随 Python 测试检查通用模板的关键 marker、占位符和流程合同
### 3. 文档链接检查 (integration/)