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

Function TestMCPManager_ConnectServer

pkg/tools/mcp/manager_test.go:156–181  ·  view source on GitHub ↗

TestMCPManager_ConnectServer 测试连接 Server (需要模拟 MCP Server)

(t *testing.T)

Source from the content-addressed store, hash-verified

154
155// TestMCPManager_ConnectServer 测试连接 Server (需要模拟 MCP Server)
156func TestMCPManager_ConnectServer(t *testing.T) {
157 t.Skip("Skipping ConnectServer test - requires mock MCP server")
158
159 registry := tools.NewRegistry()
160 manager := NewMCPManager(registry)
161
162 _, err := manager.AddServer(&MCPServerConfig{
163 ServerID: "server-1",
164 Endpoint: "http://localhost:8080/mcp",
165 })
166
167 if err != nil {
168 t.Fatalf("Failed to add server: %v", err)
169 }
170
171 ctx := context.Background()
172 err = manager.ConnectServer(ctx, "server-1")
173 if err != nil {
174 t.Fatalf("Failed to connect server: %v", err)
175 }
176
177 // 验证工具已注册
178 if manager.GetTotalToolCount() == 0 {
179 t.Error("Expected tools after connect")
180 }
181}
182
183// TestMCPManager_ConnectAll 测试连接所有 Server
184func TestMCPManager_ConnectAll(t *testing.T) {

Callers

nothing calls this directly

Calls 6

AddServerMethod · 0.95
ConnectServerMethod · 0.95
GetTotalToolCountMethod · 0.95
NewRegistryFunction · 0.92
NewMCPManagerFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected