Skip to content

Commit

Permalink
Merge #46138
Browse files Browse the repository at this point in the history
46138: github-pull-request-make: set minimum testrace duration per test r=tbg a=pbardea

This change updates the minimum allowed duration for a test run under
race in CI to be configured on a per-test basis, rather than a
per-package basis.

When there are a lot of tests in a given package that need to be
stressed by testrace, the entire package may not be given sufficient
time to complete. For example, #45962 was not passing CI since many
tests were changed within one package.

Release justification: Non-production code changes.
Release note: None

Co-authored-by: Paul Bardea <[email protected]>
  • Loading branch information
craig[bot] and pbardea committed Mar 16, 2020
2 parents d8bdc93 + 15e7ac6 commit a06be62
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions pkg/cmd/github-pull-request-make/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,17 @@ func main() {
log.Fatal(err)
}
if len(pkgs) > 0 {
// 10 minutes total seems OK, but at least a minute per test.
duration := (10 * time.Minute) / time.Duration(len(pkgs))
if duration < time.Minute {
duration = time.Minute
}
// Use a timeout shorter than the duration so that hanging tests don't
// get a free pass.
timeout := (3 * duration) / 4
for name, pkg := range pkgs {
// 10 minutes total seems OK, but at least a minute per test.
duration := (10 * time.Minute) / time.Duration(len(pkgs))
minDuration := time.Minute * time.Duration(len(pkg.tests))
if duration < minDuration {
duration = minDuration
}
// Use a timeout shorter than the duration so that hanging tests don't
// get a free pass.
timeout := (3 * duration) / 4

tests := "-"
if len(pkg.tests) > 0 {
tests = "(" + strings.Join(pkg.tests, "$$|") + "$$)"
Expand Down

0 comments on commit a06be62

Please sign in to comment.