MCPcopy Index your code
hub / github.com/coder/coder / TestConnectAll_MultipleServers

Function TestConnectAll_MultipleServers

coderd/x/chatd/mcpclient/mcpclient_test.go:188–213  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

186}
187
188func TestConnectAll_MultipleServers(t *testing.T) {
189 t.Parallel()
190 ctx := context.Background()
191 logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
192
193 ts1 := newTestMCPServer(t, echoTool())
194 ts2 := newTestMCPServer(t, greetTool())
195
196 cfg1 := makeConfig("alpha", ts1.URL)
197 cfg2 := makeConfig("beta", ts2.URL)
198
199 tools, cleanup := mcpclient.ConnectAll(
200 ctx, logger,
201 []database.MCPServerConfig{cfg1, cfg2},
202 nil,
203 uuid.Nil, nil,
204 nil,
205 )
206 t.Cleanup(cleanup)
207
208 require.Len(t, tools, 2)
209
210 names := toolNames(tools)
211 assert.Contains(t, names, "alpha__echo")
212 assert.Contains(t, names, "beta__greet")
213}
214
215func TestConnectAll_NoToolsAfterFiltering(t *testing.T) {
216 t.Parallel()

Callers

nothing calls this directly

Calls 9

ConnectAllFunction · 0.92
newTestMCPServerFunction · 0.85
echoToolFunction · 0.85
greetToolFunction · 0.85
makeConfigFunction · 0.85
toolNamesFunction · 0.85
CleanupMethod · 0.65
LenMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected