-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/test2json: streamed log output not correctly associated with parallel tests #38050
Comments
sorry for my unclear information. |
HACK to accommodate for #28 Also see: golang/go#38050
I have a fix almost ready to submit as a PR. The gist of the change is that the
Here's the test case I plan on adding (straight from the sample code referenced in the description of this issue):
And here's the expected output (made possible by the code above):
|
Change https://golang.org/cl/226757 mentions this issue: |
@bcmills mind taking a look? |
@bcmills - Thanks for the review. Stay tuned for additional commits. |
@bcmills - Ok, I've incorporated your suggestions, including the addition of an integration test/script. |
@mdwhatcott please use the Gerrit UI — https://go-review.googlesource.com/c/go/+/226757 and mark comments you’ve addressed as “resolved” rather than commenting here. Thanks. |
@andybons - Well, I definitely am new here ;) Thanks |
Thanks. There is some discussion of rolling back the output-format change (#38458), so this may only need to happen on the 1.14 branch. |
I'm going to ping this one as well :) |
I believe that #39308 will be the fix for this in 1.14. (We'll fix the output format rather than the |
Resolved in Go1.14.6. Thanks everyone! |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
YES
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Working sample code: https://github.com/mdwhatcott/parallel
The sample code referenced above runs tests in parallel. I use parallel tests quite often to prove that test cases are isolated and that there are no unintended temporal couplings in the code. The purpose of this code is to illustrate a bug in the output of
go test -json
(as well asgo tool test2json
).After upgrading to Go 1.14 I noticed that output associated with failing tests wasn't always correctly associated with the failing test. I suppose this is a consequence of the change to test output introduced in Go 1.14 which causes all output to be immediately streamed to the output rather than buffered for each test. (See the original issue (#24929) and the Go 1.14 release notes (https://golang.org/doc/go1.14#go-test).)
The repository referenced above (https://github.com/mdwhatcott/parallel) includes working tests and reference output for both Go 1.14.1 (problematic) and Go 1.13.1 (working fine).
What did you expect to see?
I expect that the output of
go test -json
correctly associate output of failing tests with the test that failed, not other tests (that might even have passed).What did you see instead?
The problem is that output associated with failing tests is sometimes associated with passing tests, probably because it (the failure output) is emitted proximate to output for the passing test. This is very problematic for test runner tools found in many text editors and IDEs (issue on JetBrains GoLand issue tracker: https://youtrack.jetbrains.com/issue/GO-8985).
Here's what the errant lines look like from executing
go test -json
:Notice that the failure output is associated with
"Test1/this_passes"
, which was a passing test with no output.The text was updated successfully, but these errors were encountered: