-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
testing: T.Cleanup is not invoked when -timeout=N is exceeded #42217
Comments
I believe this is because -timeout is implemented in the parent to command and kills the tests binary, not the current test being executed. |
It's true that the parent has a backup timeout, but that's not quite what is happening here. The timeout in the test works by calling There are other ways to stop the test without running the cleanups, such as |
Yeah that's why I linked #41891 to this issue. I think it's a best effort so I wouldn't expect SIGTERM to cleanup.
Internally do goroutines track the parent routine that spawned them? |
Yes, in the sense that a stack trace prints out where a goroutine was created. But in general goroutines don't have names or identifiers. |
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Create a test that sleeps for 2s - https://play.golang.org/p/dxQO9DFI6b1
Invoke the test with a 1 second timeout
What did you expect to see?
TestHelloWorld
is invoked.What did you see instead?
The test timed out but did not invoke
fmt.Println("cleanup")
nor it it invokefmt.Println("TestMain cleanup")
The text was updated successfully, but these errors were encountered: