MCPcopy Create free account
hub / github.com/astercloud/aster / TestMarkStepFailed

Function TestMarkStepFailed

pkg/executionplan/types_test.go:342–366  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

340}
341
342func TestMarkStepFailed(t *testing.T) {
343 plan := NewExecutionPlan("Test plan")
344 plan.AddStep("tool1", "Step 1", nil)
345
346 plan.MarkStepStarted(0)
347 testErr := errors.New("test error")
348 plan.MarkStepFailed(0, testErr)
349
350 step := plan.GetStep(0)
351 if step.Status != StepStatusFailed {
352 t.Errorf("expected status %v, got %v", StepStatusFailed, step.Status)
353 }
354
355 if step.Error != testErr.Error() {
356 t.Errorf("expected error %q, got %q", testErr.Error(), step.Error)
357 }
358
359 if step.CompletedAt == nil {
360 t.Error("expected CompletedAt to be set")
361 }
362
363 // Invalid index should not panic
364 plan.MarkStepFailed(-1, testErr)
365 plan.MarkStepFailed(100, testErr)
366}
367
368func TestSummary(t *testing.T) {
369 plan := NewExecutionPlan("Test plan")

Callers

nothing calls this directly

Calls 6

AddStepMethod · 0.95
MarkStepStartedMethod · 0.95
MarkStepFailedMethod · 0.95
GetStepMethod · 0.95
NewExecutionPlanFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected