Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: per-test-execution: make quarantined tests visible #3836

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions robots/cmd/per-test-execution/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ func (o options) validate() error {
}

type TestExecutions struct {
Name string
TotalExecutions int
FailedExecutions int
LatestFailureURL string
Name string
TotalExecutions int
FailedExecutions int
LatestFailureURL string
IsOrWasQuarantined bool
}

type TopXTestExecutions struct {
Expand Down Expand Up @@ -425,10 +426,14 @@ func writeReportFile(wg *sync.WaitGroup, ctx context.Context, storageClient *sto
reportFileName := file.Name()
log.Debugf("writing values to file %q", reportFileName)
for _, testExecution := range sortedTestExecutions {
values := []string{testExecution.Name, strconv.Itoa(testExecution.TotalExecutions), strconv.Itoa(testExecution.FailedExecutions)}
name := testExecution.Name
if testExecution.IsOrWasQuarantined {
name = "[q]" + name
}
values := []string{name, strconv.Itoa(testExecution.TotalExecutions), strconv.Itoa(testExecution.FailedExecutions)}
for _, buildNumber := range buildNumbers {
value := ""
if executionStatus, statusExists := perBuildTestExecutions[testExecution.Name][buildNumber]; statusExists {
if executionStatus, statusExists := perBuildTestExecutions[name][buildNumber]; statusExists {
value = string(executionStatus)
}
values = append(values, value)
Expand Down Expand Up @@ -479,19 +484,17 @@ func condenseToTestExecutions(periodicJobDir string, results []*flakefinder.JobR
FailedExecutions: 0,
}
switch test.Status {
case junit2.StatusFailed, junit2.StatusError:
case junit2.StatusFailed, junit2.StatusError, junit2.StatusPassed:
if _, exists := allTestExecutions[testName]; !exists {
allTestExecutions[testName] = testExecutionRecord
}
testExecutionRecord = allTestExecutions[testName]
testExecutionRecord.FailedExecutions = testExecutionRecord.FailedExecutions + 1
testExecutionRecord.TotalExecutions = testExecutionRecord.TotalExecutions + 1
case junit2.StatusPassed:
if _, exists := allTestExecutions[testName]; !exists {
allTestExecutions[testName] = testExecutionRecord
allTestExecutions[testName].TotalExecutions = allTestExecutions[testName].TotalExecutions + 1
if test.Status == junit2.StatusFailed || test.Status == junit2.StatusError {
allTestExecutions[testName].FailedExecutions = allTestExecutions[testName].FailedExecutions + 1
}
if flakefinder.IsQuarantineLabelPresent(test.Name) {
allTestExecutions[testName].IsOrWasQuarantined = true
}
testExecutionRecord = allTestExecutions[testName]
testExecutionRecord.TotalExecutions = testExecutionRecord.TotalExecutions + 1
default:
// NOOP
}
Expand Down