-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Potential issue when running go test -json #47
Comments
This is a known issue with running tests with I'll have to see how invasive the PR is to fix this, but hopefully it won't be too bad.
|
Tentatively, a fix for this would involve retrofitting |
To avoid breaking pre-1.7 compatibility (if we really care about going that far back), it would probably also be a good idea to denormalize the pre-1.7 code into a single file and EOL it. I might even go so far as to print a warning, but that's just me ;) |
Currently, I don't see, what the difference is between "... taking function references to ..." and "... calling them directly ...". But maybe this would become more clear from a concrete PR. In regards to calling
I think, this call is on @matryer. For me personally, it would be ok to ditch Go 1.7 support. |
Hey Mat, long time. Ran into a curious issue worth filing.
Summary
Running
go test -json ...
and using this package reports incorrect test names in JSON events. This could very well be a bug in Go (test2json), but figured I'd start here because if I removeis
and use regular std. lib primitives it reports the correct thing.Reproducible example
I noticed this happening in https://github.com/pressly/goose and put together a PR to showcase the problem.
In this commit I purposefully changed a test to trigger a failure. Note the name of the test is
TestNotAllowMissing
.pressly/goose@9b7c732#diff-080f0d7ba408eaf6181e1f61388995ebcd57fdd1468ffafffbf789176531418fR30
When I run
go test -v -json -count=1 ./tests/e2e -dialect=postgres
I happily get JSON output. But, the test name in the JSON event doesn't line up with the Output.I was expecting Output that
is
prints to be associated with test namedTestNotAllowMissing
, but instead it was associated with another test namedTestMigrateFull
. (the name is non-deterministic, it changes between runs).The raw output can be found here . But I've copied and trimmed the relevant bits:
The first JSON event refers to
allow_missing_test.go:30
, in the code base the call site on line 30 is located within the test named:TestNotAllowMissing
, but the test name isTestMigrateFull
.The second JSON event correctly outputs the failure under the test named
TestNotAllowMissing
.This could very well be a bug in how go test prints JSON events, but I suspect it may be something within this library. I say this because if I remove
is
from that specific test (TestNotAllowMissing
) I see the expected output associated with the correct Test name:Raw output can be found here
The text was updated successfully, but these errors were encountered: