package scheduler import "testing" func TestAggregateDispatchResult(t *testing.T) { tests := []struct { name string generateCount int failedCount int wantStatus string wantFailureCount bool }{ {name: "all success", generateCount: 3, failedCount: 0, wantStatus: "success"}, {name: "partial success", generateCount: 3, failedCount: 1, wantStatus: "partial"}, {name: "all failed", generateCount: 3, failedCount: 3, wantStatus: "failed", wantFailureCount: true}, {name: "zero generate count defaults to one", generateCount: 0, failedCount: 1, wantStatus: "failed", wantFailureCount: true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := aggregateDispatchResult(tt.generateCount, tt.failedCount) if got.status != tt.wantStatus { t.Fatalf("status = %q, want %q", got.status, tt.wantStatus) } if got.countAsFailure != tt.wantFailureCount { t.Fatalf("countAsFailure = %v, want %v", got.countAsFailure, tt.wantFailureCount) } }) } }