gotestsum icon indicating copy to clipboard operation
gotestsum copied to clipboard

feature request: global timeout

Open nfi-hashicorp opened this issue 2 years ago • 1 comments

You can use the go test -timeout flag, but AFAICT, that wouldn't take into account retries.

nfi-hashicorp avatar Jul 26 '23 18:07 nfi-hashicorp

Hello! That's correct, the -test.timeout flag would only limit the time of each re-run. A --timeout flag seems like a reasonable addition, but I would like to avoid flags that mirror existing go test flags. Maybe --rerun-timeout to make it clear that it's only relevant to reruns.

Another option might be to examine the args passed to go test, and if we notice a -test.timeout or -timeout flag, use that timeout automatically. That won't work with --raw-command if the timeout is in the command and not the command line.

As a workaround the timeout command on linux should also work pretty well:

timeout -s INT 100 gotestsum ...

This signal handler will forward the interrupt to go test. With this approach we don't get the stack trace.

Another improvement would be to send SIGABRT to go test, which should give us a goroutine stack trace (like -test.timeout would) instead of only interrupting the run. I opened #346 to add support for sending SIGABRT.

dnephin avatar Jul 30 '23 16:07 dnephin