MCPcopy Create free account
hub / github.com/astercloud/aster / TestMiddlewareStack_Integration

Function TestMiddlewareStack_Integration

pkg/middleware/integration_test.go:12–49  ·  view source on GitHub ↗

TestMiddlewareStack_Integration 集成测试: Middleware Stack

(t *testing.T)

Source from the content-addressed store, hash-verified

10
11// TestMiddlewareStack_Integration 集成测试: Middleware Stack
12func TestMiddlewareStack_Integration(t *testing.T) {
13 // 1. 创建 Backend
14 backend := backends.NewStateBackend()
15
16 // 2. 创建 FilesystemMiddleware
17 fsMiddleware := NewFilesystemMiddleware(&FilesystemMiddlewareConfig{
18 Backend: backend,
19 EnableEviction: true,
20 TokenLimit: 100, // 低阈值用于测试
21 })
22
23 // 3. 创建 Stack
24 stack := NewStack([]Middleware{
25 fsMiddleware,
26 })
27
28 // 测试工具收集
29 tools := stack.Tools()
30 if len(tools) != 6 {
31 t.Errorf("Expected 6 tools, got %d", len(tools))
32 }
33
34 // 验证工具名称
35 expectedTools := map[string]bool{
36 "Read": true,
37 "Write": true,
38 "Ls": true,
39 "Edit": true,
40 "Glob": true,
41 "Grep": true,
42 }
43
44 for _, tool := range tools {
45 if !expectedTools[tool.Name()] {
46 t.Errorf("Unexpected tool: %s", tool.Name())
47 }
48 }
49}
50
51// TestSubAgentMiddleware_Integration 集成测试: SubAgent Middleware
52func TestSubAgentMiddleware_Integration(t *testing.T) {

Callers

nothing calls this directly

Calls 5

ToolsMethod · 0.95
NewStateBackendFunction · 0.92
NewFilesystemMiddlewareFunction · 0.85
NewStackFunction · 0.85
NameMethod · 0.65

Tested by

no test coverage detected