Skip to content
Open
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
22 changes: 19 additions & 3 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,13 +872,29 @@ func runProvidedTests(testsBank map[string]*register.Test, patterns []string, mu
newOutputDir := filepath.Join(outputDir, "rerun")
fmt.Printf("\n\n======== Re-running failed tests (flake detection) ========\n\n")
reRunErr := runProvidedTests(testsToRerun, []string{"*"}, multiply, false, rerunSuccessTags, pltfrm, newOutputDir)
if reRunErr == nil && allTestsAllowRerunSuccess(testsToRerun, rerunSuccessTags) {
// Four possible outcomes from the rerun:
// 1. reRunErr == nil && allTestsAllowRerunSuccess == true:
// Tests passed on rerun AND have the required tags to allow rerun success.
// Reset to success (runErr = nil).
// 2. reRunErr != nil && allTestsAllowRerunSuccess == false:
// Tests failed on rerun and don't have tags. Use the rerun error (runErr = reRunErr).
// 3. reRunErr == nil && allTestsAllowRerunSuccess == false:
// Tests passed on rerun BUT don't have the required tags to allow rerun success.
// Keep the original error (don't modify runErr) - the initial failure stands.
// 4. reRunErr != nil && allTestsAllowRerunSuccess == true:
// Tests failed on rerun even though they have allow-rerun-success tags.
// Use the rerun error (runErr = reRunErr) - tags only matter when rerun passes.
if reRunErr != nil {
// Scenarios 2 & 4: Rerun failed - use the rerun error regardless of tags
runErr = reRunErr
} else if allTestsAllowRerunSuccess(testsToRerun, rerunSuccessTags) {
// Scenario 1: Rerun passed AND tests have tags to allow rerun success
runErr = nil // reset to success since all tests allowed rerun success
numFailedTests = 0 // zero out the tally of failed tests
} else {
runErr = reRunErr
// Scenario 3: Rerun passed but tags don't allow success.
fmt.Println("Tests passed on rerun but lack tags to allow rerun success; original failure stands.")
}

}

// Return ErrWarnOnTestFail when ONLY tests with warn:true feature failed
Expand Down