MCPcopy Index your code
hub / github.com/docker/docker-agent / startA2AServer

Function startA2AServer

e2e/a2a_test.go:169–197  ·  view source on GitHub ↗
(t *testing.T, agentFile string, runConfig *config.RuntimeConfig)

Source from the content-addressed store, hash-verified

167}
168
169func startA2AServer(t *testing.T, agentFile string, runConfig *config.RuntimeConfig) a2a.AgentCard {
170 t.Helper()
171
172 var lc net.ListenConfig
173 ln, err := lc.Listen(t.Context(), "tcp", ":0")
174 require.NoError(t, err)
175
176 go func() {
177 _ = a2aserver.Run(t.Context(), agentFile, "root", filepath.Join(t.TempDir(), "session.db"), runConfig, ln)
178 }()
179
180 port := ln.Addr().(*net.TCPAddr).Port
181 serverURL := fmt.Sprintf("http://localhost:%d", port)
182
183 cardReq, err := http.NewRequestWithContext(t.Context(), http.MethodGet, serverURL+a2asrv.WellKnownAgentCardPath, http.NoBody)
184 require.NoError(t, err)
185
186 resp, err := http.DefaultClient.Do(cardReq)
187 require.NoError(t, err)
188 defer resp.Body.Close()
189
190 require.Equal(t, http.StatusOK, resp.StatusCode)
191
192 var agentCard a2a.AgentCard
193 err = json.NewDecoder(resp.Body).Decode(&agentCard)
194 require.NoError(t, err)
195
196 return agentCard
197}

Callers 4

TestA2AServer_AgentCardFunction · 0.85
TestA2AServer_InvokeFunction · 0.85
TestA2AServer_MultiAgentFunction · 0.85

Calls 5

ListenMethod · 0.80
ContextMethod · 0.80
RunMethod · 0.65
DoMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected