(t *testing.T)
| 736 | } |
| 737 | |
| 738 | func TestExecuteWithStepTimeout(t *testing.T) { |
| 739 | // Create a tool that takes longer than the timeout |
| 740 | tool1 := newDelayedMockTool("tool1", "result1", 200*time.Millisecond) |
| 741 | |
| 742 | toolMap := map[string]tools.Tool{ |
| 743 | "tool1": tool1, |
| 744 | } |
| 745 | |
| 746 | executor := NewExecutor(toolMap) |
| 747 | |
| 748 | plan := NewExecutionPlan("Step timeout test") |
| 749 | plan.AddStep("tool1", "Step 1", nil) |
| 750 | plan.Options.RequireApproval = false |
| 751 | plan.Options.StepTimeoutMs = 50 // 50ms timeout |
| 752 | |
| 753 | ctx := context.Background() |
| 754 | toolCtx := &tools.ToolContext{AgentID: "test-agent"} |
| 755 | |
| 756 | err := executor.Execute(ctx, plan, toolCtx) |
| 757 | if err == nil { |
| 758 | t.Fatal("expected timeout error") |
| 759 | } |
| 760 | |
| 761 | if plan.Steps[0].Status != StepStatusFailed { |
| 762 | t.Errorf("expected step status %v, got %v", StepStatusFailed, plan.Steps[0].Status) |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | func TestDependencyNotSatisfied(t *testing.T) { |
| 767 | tool1 := newMockTool("tool1", nil, errors.New("tool1 error")) |
nothing calls this directly
no test coverage detected