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

Method ConnectRPC29

agent/agenttest/client.go:149–170  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

147}
148
149func (c *Client) ConnectRPC29(ctx context.Context) (
150 agentproto.DRPCAgentClient29, proto.DRPCTailnetClient28, error,
151) {
152 conn, lis := drpcsdk.MemTransportPipe()
153 c.LastWorkspaceAgent = func() {
154 _ = conn.Close()
155 _ = lis.Close()
156 }
157 c.t.Cleanup(c.LastWorkspaceAgent)
158 serveCtx, cancel := context.WithCancel(ctx)
159 c.t.Cleanup(cancel)
160 streamID := tailnet.StreamID{
161 Name: "agenttest",
162 ID: c.agentID,
163 Auth: tailnet.AgentCoordinateeAuth{ID: c.agentID},
164 }
165 serveCtx = tailnet.WithStreamID(serveCtx, streamID)
166 go func() {
167 _ = c.server.Serve(serveCtx, lis)
168 }()
169 return agentproto.NewDRPCAgentClient(conn), proto.NewDRPCTailnetClient(conn), nil
170}
171
172func (c *Client) GetLifecycleStates() []codersdk.WorkspaceAgentLifecycle {
173 return c.fakeAgentAPI.GetLifecycleStates()

Calls 6

MemTransportPipeFunction · 0.92
WithStreamIDFunction · 0.92
NewDRPCTailnetClientFunction · 0.92
CloseMethod · 0.65
CleanupMethod · 0.65
ServeMethod · 0.45

Tested by 1