MCPcopy
hub / github.com/google/ax / TestController_Exec_LastSeq_NotFound

Function TestController_Exec_LastSeq_NotFound

internal/controller/controller_test.go:239–283  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

237}
238
239func TestController_Exec_LastSeq_NotFound(t *testing.T) {
240 ctx := context.Background()
241 cid := "test-conv-seq-not-found"
242
243 log := &executortest.MemoryEventLog{}
244 // Pre-populate history
245 log.AllEvents = []*proto.ConversationEvent{
246 {
247 ConversationId: cid,
248 Seq: 1,
249 Messages: []*proto.Message{
250 {Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "msg 1"}}}},
251 },
252 State: proto.State_STATE_COMPLETED,
253 },
254 }
255
256 c, err := New(ctx, Config{
257 EventLogBuilder: func() (executor.EventLog, error) {
258 return log, nil
259 },
260 PlannerBuilder: func(ctx context.Context, r *Registry) (agent.Agent, error) {
261 return &dummyAgent{}, nil
262 },
263 })
264 if err != nil {
265 t.Fatal(err)
266 }
267 defer c.Close()
268
269 handler := ExecHandler(func(resp *proto.ExecResponse) error {
270 return nil
271 })
272
273 err = c.Exec(ctx, &proto.ExecRequest{
274 ConversationId: cid,
275 LastSeq: 99,
276 }, handler)
277 if err == nil {
278 t.Fatal("expected error when LastSeq is not found, got nil")
279 }
280 if err.Error() != "last_seq 99 not found" {
281 t.Fatalf("expected 'last_seq 99 not found', got %v", err)
282 }
283}
284
285func TestController_Exec_WaitsForConfirmation(t *testing.T) {
286 ctx := context.Background()

Callers

nothing calls this directly

Calls 4

ExecHandlerFuncType · 0.85
NewFunction · 0.70
CloseMethod · 0.65
ExecMethod · 0.65

Tested by

no test coverage detected