TestMCPErrorHandling tests error scenarios through MCP layer.
(t *testing.T)
| 585 | |
| 586 | // TestMCPErrorHandling tests error scenarios through MCP layer. |
| 587 | func TestMCPErrorHandling(t *testing.T) { |
| 588 | for name, newStore := range stores() { |
| 589 | t.Run(name, func(t *testing.T) { |
| 590 | s := newStore(t) |
| 591 | kb := knowledgeBase{s: s} |
| 592 | |
| 593 | ctx := context.Background() |
| 594 | |
| 595 | _, _, err := kb.AddObservations(ctx, nil, AddObservationsArgs{ |
| 596 | Observations: []Observation{ |
| 597 | { |
| 598 | EntityName: "NonExistentEntity", |
| 599 | Contents: []string{"This should fail"}, |
| 600 | }, |
| 601 | }, |
| 602 | }) |
| 603 | if err == nil { |
| 604 | t.Errorf("expected MCP AddObservations to return error for non-existent entity") |
| 605 | } else { |
| 606 | // Verify the error message contains expected text |
| 607 | want := "entity with name NonExistentEntity not found" |
| 608 | if !strings.Contains(err.Error(), want) { |
| 609 | t.Errorf("expected error message to contain '%s', got: %v", want, err) |
| 610 | } |
| 611 | } |
| 612 | }) |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | // TestMCPResponseFormat verifies MCP response format consistency. |
| 617 | func TestMCPResponseFormat(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…