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

Function TestMarkStepStarted

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

Source from the content-addressed store, hash-verified

279}
280
281func TestMarkStepStarted(t *testing.T) {
282 plan := NewExecutionPlan("Test plan")
283 plan.AddStep("tool1", "Step 1", nil)
284 plan.AddStep("tool2", "Step 2", nil)
285
286 plan.MarkStepStarted(0)
287
288 step := plan.GetStep(0)
289 if step.Status != StepStatusRunning {
290 t.Errorf("expected status %v, got %v", StepStatusRunning, step.Status)
291 }
292
293 if step.StartedAt == nil {
294 t.Error("expected StartedAt to be set")
295 }
296
297 if plan.CurrentStep != 0 {
298 t.Errorf("expected CurrentStep 0, got %d", plan.CurrentStep)
299 }
300
301 // Mark second step
302 plan.MarkStepStarted(1)
303 if plan.CurrentStep != 1 {
304 t.Errorf("expected CurrentStep 1, got %d", plan.CurrentStep)
305 }
306
307 // Invalid index should not panic
308 plan.MarkStepStarted(-1)
309 plan.MarkStepStarted(100)
310}
311
312func TestMarkStepCompleted(t *testing.T) {
313 plan := NewExecutionPlan("Test plan")

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected