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

Function startServer

pkg/server/server_test.go:93–117  ·  view source on GitHub ↗
(t *testing.T, ctx context.Context, agentsDir string)

Source from the content-addressed store, hash-verified

91}
92
93func startServer(t *testing.T, ctx context.Context, agentsDir string) string {
94 t.Helper()
95
96 var store mockStore
97 runConfig := config.RuntimeConfig{}
98
99 sources, err := config.ResolveSources(agentsDir, nil)
100 require.NoError(t, err)
101 srv, err := New(ctx, store, &runConfig, 0, sources, "")
102 require.NoError(t, err)
103
104 socketPath := "unix://" + filepath.Join(t.TempDir(), "sock")
105 ln, err := Listen(ctx, socketPath)
106 require.NoError(t, err)
107 go func() {
108 <-ctx.Done()
109 _ = ln.Close()
110 }()
111
112 go func() {
113 _ = srv.Serve(ctx, ln)
114 }()
115
116 return socketPath
117}
118
119func httpGET(t *testing.T, ctx context.Context, socketPath, path string) []byte {
120 t.Helper()

Callers 3

TestServer_ListAgentsFunction · 0.85
TestServer_EmptyListFunction · 0.85
TestServer_ListSessionsFunction · 0.85

Calls 5

ResolveSourcesFunction · 0.92
ListenFunction · 0.85
ServeMethod · 0.80
NewFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected