Skip to content

Commit

Permalink
github-pull-request-make: allow time for pkgs with a lot of tests
Browse files Browse the repository at this point in the history
Release justification: Non-production code changes.
Release note: None
  • Loading branch information
pbardea committed Mar 15, 2020
1 parent 9c2b292 commit ab2a338
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 ab2a338

Please sign in to comment.