in pkg/summarizer/summary.go [969:1055]
func overallStatus(grid *statepb.Grid, recent int, stale string, brokenState bool, alerts []*summarypb.FailingTestSummary, features FeatureFlags, colCells gridStats, opts *configpb.DashboardTabStatusCustomizationOptions) summarypb.DashboardTabSummary_TabStatus {
if brokenState {
return summarypb.DashboardTabSummary_BROKEN
}
if stale != "" {
return summarypb.DashboardTabSummary_STALE
}
if len(alerts) > 0 {
return summarypb.DashboardTabSummary_FAIL
}
// safeguard PENDING status behind a flag
if features.AllowMinNumberOfRuns && opts.GetMinAcceptableRuns() > int32(colCells.completedCols-colCells.ignoredCols) {
return summarypb.DashboardTabSummary_PENDING
}
results := result.Map(grid.Rows)
moreCols := true
var passing bool
var flaky bool
// We want to look at recent columns, skipping over any that are still running.
for moreCols && recent > 0 {
moreCols = false
var foundCol bool
var running bool
var ignored bool
// One result off each column since we don't know which
// cells are running ahead of time.
for _, resultF := range results {
r, ok := resultF()
if !ok {
continue
}
moreCols = true
if r == statuspb.TestStatus_RUNNING {
running = true
// not break because we need to pull this column's
// result off every row's channel.
continue
}
if features.AllowIgnoredColumns && result.Ignored(r, opts) {
ignored = true
continue
}
r = coalesceResult(r, result.IgnoreRunning)
if r == statuspb.TestStatus_NO_RESULT {
continue
}
// any failure in a recent column results in flaky
if r != statuspb.TestStatus_PASS {
flaky = true
continue
}
foundCol = true
}
// Running columns are unfinished and therefore should
// not count as "recent" until they finish.
if running {
continue
}
// Ignored columns are ignored from tab status but they do count as recent
// Failures in this col are ignored too
if ignored {
recent--
flaky = false
continue
}
if flaky {
if isAcceptable(colCells, opts, features) {
return summarypb.DashboardTabSummary_ACCEPTABLE
}
return summarypb.DashboardTabSummary_FLAKY
}
if foundCol {
passing = true
recent--
}
}
if passing {
return summarypb.DashboardTabSummary_PASS
}
return summarypb.DashboardTabSummary_UNKNOWN
}