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

Closed
honDhan opened this issue Feb 19, 2021 · 5 comments
Closed

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

honDhan opened this issue Feb 19, 2021 · 5 comments
Labels
FrozenDueToAge Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@honDhan
Copy link

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
Copy link
Member

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

@kivilahtio
Copy link

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
Member

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

@ianlancetaylor ianlancetaylor added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 19, 2021
@gopherbot
Copy link
Contributor

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@DmitriyMV
Copy link
Contributor

@honDhan just FYI cmd/go: add per-test timeouts was accepted.

@rsc rsc moved this to Declined in Proposals Aug 10, 2022
@rsc rsc added this to Proposals Aug 10, 2022
@rsc rsc removed this from Proposals Oct 19, 2022
@golang golang locked and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants