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

Function TestMarkStepCompleted

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

Source from the content-addressed store, hash-verified

310}
311
312func TestMarkStepCompleted(t *testing.T) {
313 plan := NewExecutionPlan("Test plan")
314 plan.AddStep("tool1", "Step 1", nil)
315
316 plan.MarkStepStarted(0)
317 time.Sleep(10 * time.Millisecond) // Ensure some duration
318 plan.MarkStepCompleted(0, "success result")
319
320 step := plan.GetStep(0)
321 if step.Status != StepStatusCompleted {
322 t.Errorf("expected status %v, got %v", StepStatusCompleted, step.Status)
323 }
324
325 if step.Result != "success result" {
326 t.Errorf("expected result %q, got %v", "success result", step.Result)
327 }
328
329 if step.CompletedAt == nil {
330 t.Error("expected CompletedAt to be set")
331 }
332
333 if step.DurationMs <= 0 {
334 t.Errorf("expected positive duration, got %d", step.DurationMs)
335 }
336
337 // Invalid index should not panic
338 plan.MarkStepCompleted(-1, nil)
339 plan.MarkStepCompleted(100, nil)
340}
341
342func TestMarkStepFailed(t *testing.T) {
343 plan := NewExecutionPlan("Test plan")

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected