-
Notifications
You must be signed in to change notification settings - Fork 207
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
Swap to go-junit-report for parsing go test output #982
Swap to go-junit-report for parsing go test output #982
Conversation
@@ -169,11 +169,6 @@ func TestGoIgnoreUnknownOutput(t *testing.T) { | |||
assert.Equal(t, 0, results.Skips()) | |||
} | |||
|
|||
func TestGoFailIfUnknownTestPasses(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how often we expect this particular case to come up. Go Junit report doesn't error out in this scenario - but it does 'misattribute' a failure to a Test case, so I'm not sure it's 100% correct in that regard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That dates back to literally before the dawn of time (initial commit). I don't think I've ever seen it actually happen though; not terribly bothered about losing this one case if everything else is still passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good! Always nice to have less code to maintain ourselves :)
src/test/go_results.go
Outdated
testPackage, err := parser.Parse(bytes.NewReader(data), "") | ||
|
||
if err != nil { | ||
return core.TestSuite{}, fmt.Errorf("Failed to parser go test output: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Failed to parser
-> Failed to parse
I doubt anyone deeply cares about the older versions; we support I think 1.8+ (https://golang.org/pkg/testing/#MainStart is probably the most critical thing there) but I don't imagine lots of people deeply care about building 1.8 or 1.9 with the latest version of plz. |
…achine#982)" This reverts commit 13adc19.
Swap to using a 3rd party library for parsing Go test output.
This should cover more edge cases than our previous simple parser.
An additional note - by reading various PRs in
go-junit-report
around the different edge cases in Go test output. I've found that go test has a json output which should be used for parsing tasks like we're doing. However there's discussions on thego-junit-report
repo which suggest that there aren't much gains to be had just yet by using the go test json output.Also the json option only exists for Go 1.10+. I think the best thing to do going forwards is to revisit this if we officially stop support Go versions < 1.10, to see if we hit any more edge cases that would be solved by using a json format parser.