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

proposal: testing: timeouts for each or a particular test #44442

Open
honDhan opened this issue Feb 19, 2021 · 3 comments
Open

proposal: testing: timeouts for each or a particular test #44442

honDhan opened this issue Feb 19, 2021 · 3 comments

Comments

@honDhan
Copy link

@honDhan honDhan commented Feb 19, 2021

What version of Go are you using (go version)?

$ go version
go version go1.15.6 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you expect to see?

Similar to #10529.
Proposal: add a test-specific timeout

For CI pipelines and other use cases, it's useful to have a test-specific timeout instead of a timeout for the whole run.
For example, it would be nice to specify a timeout of 10s for each test. This way, more tests can be added without having to reconfigure the -timeout.

Additionally, it would also be nice to be able to pass a test even after timing out. This way, you can set different test-specific timeouts to adjust which tests run.

@honDhan honDhan changed the title testing: timeouts for each or a particular test proposal: timeouts for each or a particular test Feb 19, 2021
@gopherbot gopherbot added this to the Proposal milestone Feb 19, 2021
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals Feb 20, 2021
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Feb 20, 2021

Can you make some specific proposals for how this should work? Thanks.

@kivilahtio
Copy link

@kivilahtio kivilahtio commented Apr 19, 2021

It would be best to have a timeout wrapper as a part of the test suite, so something like:

/// return true, or fail the test
t.Timeout(10*time.Millis, func() {
// do the agitation of the particle
}, "Description of the test, eg 'agitate the space-schitzoid to reach boiling point in the certified duration'")

But writing a wrapper is not that difficult:
https://stackoverflow.com/questions/24929790/how-to-set-the-go-timeout-flag-on-go-test

@ianlancetaylor ianlancetaylor changed the title proposal: timeouts for each or a particular test proposal: testing: timeouts for each or a particular test Apr 19, 2021
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Apr 19, 2021

I don't see how to implement t.Timeout. What should happen when the timeout expires?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Proposals
Incoming
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants