Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: global timeout #344

Open
nfi-hashicorp opened this issue Jul 26, 2023 · 1 comment
Open

feature request: global timeout #344

nfi-hashicorp opened this issue Jul 26, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@nfi-hashicorp
Copy link
Contributor

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

@dnephin dnephin added the enhancement New feature or request label Jul 30, 2023
@dnephin
Copy link
Member

dnephin commented Jul 30, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants