diff --git a/Makefile b/Makefile index 52ab845..edc28a1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: infra infra-down devnats demo e2e gateway dispatcher mcp-go mcp-py mcp-py-setup web admin desktop desktop-build tidy +.PHONY: infra infra-down devnats demo e2e test test-go test-web test-py gateway dispatcher mcp-go mcp-py mcp-py-setup web admin desktop desktop-build tidy infra: ## 启动基础设施 (NATS / Postgres / Redis / Milvus / Neo4j) docker compose up -d @@ -15,6 +15,23 @@ demo: ## 一键演示 Gateway→NATS→Dispatcher 任务流(无需 Doc e2e: ## 跑共享 bus 的端到端测试(内嵌 NATS):任务流 / 工具调用 / Token 流 cd sundynix-shared && go test ./bus/ -run 'TestTaskRoundTrip|TestToolCallRoundTrip|TestTokenStreamRoundTrip' -v +test: test-go test-web ## 跑全部测试(后端各模块 go test + 前端类型检查) + +test-go: ## 各 Go 模块单测(DB 集成测试无 MEMORY_TEST_DSN 自动跳过) + cd sundynix-shared && go test ./... + cd sundynix-gateway && go test ./... + cd sundynix-dispatcher && go test ./... + cd sundynix-mcp-go && go test ./... + +test-web: ## 前端 TypeScript 类型检查 + cd sundynix-desktop/frontend && npx tsc --noEmit + +test-py: ## mcp-py 沙箱守卫测试(需 venv;缺 pytest 用内置 harness 兜底) + cd sundynix-mcp-py && ( PYTHONPATH=src:tests .venv/bin/python -m pytest tests/ -q 2>/dev/null \ + || PYTHONPATH=src:tests .venv/bin/python -c "import test_sandbox as t; \ +fns=[getattr(t,n) for n in dir(t) if n.startswith('test_')]; \ +[ (f(),print('PASS',f.__name__)) for f in fns ]; print(f'{len(fns)} passed')" ) + gateway: cd sundynix-gateway && go run ./cmd/server diff --git a/PROGRESS.md b/PROGRESS.md index 1416102..b0a1d04 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -101,7 +101,7 @@ - [ ] PDF 导出 Wails 真机验证(不行则回退后端内嵌 CJK 字体出 PDF) - [ ] 报告生成并发健壮性(writeSections 降并发 / 加单次超时,治偶发卡顿) - [ ] MinIO 大文档改名/删除的孤儿对象 GC -- [ ] `make test` 目标(一键跑全后端测试) +- [x] `make test` 目标(test-go / test-web / test-py 一键跑) ---