File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,18 @@ func Wrap(pkg string) error {
131131 // and will be killed by Bazel after the grace period instead.
132132 signal .Ignore (syscall .SIGTERM )
133133
134+ secsString , ok := os .LookupEnv ("TEST_TIMEOUT" )
135+ if ok {
136+ timeoutSecs , err := strconv .Atoi (secsString )
137+ if err != nil {
138+ return fmt .Errorf ("could not parse TEST_TIMEOUT string %s: got error %w" , secsString , err )
139+ }
140+ mungedTimeoutSecs := timeoutSecs - 3
141+ if mungedTimeoutSecs <= 0 {
142+ mungedTimeoutSecs = timeoutSecs
143+ }
144+ args = append ([]string {"-test.timeout" , fmt .Sprintf ("%ds" , mungedTimeoutSecs )}, args ... )
145+ }
134146 cmd := exec .Command (exePath , args ... )
135147 cmd .Env = append (os .Environ (), "GO_TEST_WRAP=0" )
136148 cmd .Stderr = io .MultiWriter (os .Stderr , streamMerger .ErrW )
You can’t perform that action at this time.
0 commit comments