( t *testing.T, db database.Store, ps dbpubsub.Pubsub, agentID uuid.UUID, planContent string, )
| 227 | } |
| 228 | |
| 229 | func newWorkspaceToolTestServer( |
| 230 | t *testing.T, |
| 231 | db database.Store, |
| 232 | ps dbpubsub.Pubsub, |
| 233 | agentID uuid.UUID, |
| 234 | planContent string, |
| 235 | ) *chatd.Server { |
| 236 | t.Helper() |
| 237 | |
| 238 | ctrl := gomock.NewController(t) |
| 239 | mockConn := agentconnmock.NewMockAgentConn(ctrl) |
| 240 | mockConn.EXPECT().SetExtraHeaders(gomock.Any()).AnyTimes() |
| 241 | mockConn.EXPECT().ContextConfig(gomock.Any()). |
| 242 | Return(workspacesdk.ContextConfigResponse{}, xerrors.New("not supported")).AnyTimes() |
| 243 | mockConn.EXPECT().ListMCPTools(gomock.Any()). |
| 244 | Return(workspacesdk.ListMCPToolsResponse{}, nil).AnyTimes() |
| 245 | mockConn.EXPECT().LS(gomock.Any(), gomock.Any(), gomock.Any()). |
| 246 | Return(workspacesdk.LSResponse{}, nil).AnyTimes() |
| 247 | mockConn.EXPECT().ReadFile(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). |
| 248 | DoAndReturn(func(_ context.Context, path string, _, _ int64) (io.ReadCloser, string, error) { |
| 249 | if path == "/home/coder/PLAN.md" { |
| 250 | return io.NopCloser(strings.NewReader(planContent)), "", nil |
| 251 | } |
| 252 | return io.NopCloser(strings.NewReader("")), "", nil |
| 253 | }).AnyTimes() |
| 254 | |
| 255 | return newActiveTestServer(t, db, ps, func(cfg *chatd.Config) { |
| 256 | cfg.AgentConn = func(_ context.Context, gotAgentID uuid.UUID) (workspacesdk.AgentConn, func(), error) { |
| 257 | require.Equal(t, agentID, gotAgentID) |
| 258 | return mockConn, func() {}, nil |
| 259 | } |
| 260 | }) |
| 261 | } |
| 262 | |
| 263 | func TestInterruptChatBroadcastsStatusAcrossInstances(t *testing.T) { |
| 264 | t.Parallel() |
no test coverage detected