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

Function TestSummary

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

Source from the content-addressed store, hash-verified

366}
367
368func TestSummary(t *testing.T) {
369 plan := NewExecutionPlan("Test plan")
370 plan.AddStep("tool1", "Step 1", nil)
371 plan.AddStep("tool2", "Step 2", nil)
372 plan.AddStep("tool3", "Step 3", nil)
373 plan.AddStep("tool4", "Step 4", nil)
374
375 // Initial state: all pending
376 summary := plan.Summary()
377 if summary.TotalSteps != 4 {
378 t.Errorf("expected TotalSteps 4, got %d", summary.TotalSteps)
379 }
380 if summary.Pending != 4 {
381 t.Errorf("expected Pending 4, got %d", summary.Pending)
382 }
383 if summary.Progress != 0 {
384 t.Errorf("expected Progress 0, got %f", summary.Progress)
385 }
386
387 // Mark some steps
388 plan.Steps[0].Status = StepStatusCompleted
389 plan.Steps[1].Status = StepStatusFailed
390 plan.Steps[2].Status = StepStatusRunning
391 // step 4 remains pending
392
393 summary = plan.Summary()
394 if summary.Completed != 1 {
395 t.Errorf("expected Completed 1, got %d", summary.Completed)
396 }
397 if summary.Failed != 1 {
398 t.Errorf("expected Failed 1, got %d", summary.Failed)
399 }
400 if summary.Running != 1 {
401 t.Errorf("expected Running 1, got %d", summary.Running)
402 }
403 if summary.Pending != 1 {
404 t.Errorf("expected Pending 1, got %d", summary.Pending)
405 }
406 if summary.Progress != 25 {
407 t.Errorf("expected Progress 25, got %f", summary.Progress)
408 }
409}
410
411func TestSummaryEmptyPlan(t *testing.T) {
412 plan := NewExecutionPlan("Empty plan")

Callers

nothing calls this directly

Calls 3

AddStepMethod · 0.95
SummaryMethod · 0.95
NewExecutionPlanFunction · 0.85

Tested by

no test coverage detected