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

go: downloading lines after JSON causes panic. #45

Open
Sean-Der opened this issue May 21, 2022 · 8 comments
Open

go: downloading lines after JSON causes panic. #45

Sean-Der opened this issue May 21, 2022 · 8 comments

Comments

@Sean-Der
Copy link

Sean-Der commented May 21, 2022

Thank you for this fantastic tool! We have been using it for Pion and has saved me significant time already :) reading test logs without it is terrible.

I am using go-acc and in some cases will generate go: downloading entries after JSON output. It causes this panic.

panic: unexpected output encountered: go: downloading github.com/stretchr/testify v1.7.1 (Did you use -json on go test?)

goroutine 7 [running]:
github.com/haveyoudebuggedit/gotestfmt/v2/parser.parse(0x0?, 0xc000070540, 0xc0000705a0, 0xc000070600, 0xc000070660)
        /home/sean/go/pkg/mod/github.com/haveyoudebuggedit/gotestfmt/[email protected]/parser/parse.go:165 +0x1125
created by github.com/haveyoudebuggedit/gotestfmt/v2/parser.Parse
        /home/sean/go/pkg/mod/github.com/haveyoudebuggedit/gotestfmt/[email protected]/parser/parse.go:26 +0x10a

In your opinion is this a gotestfmt or go-acc bug? I have attached a reproduce as well.
gotest.log

@ghost
Copy link

ghost commented May 22, 2022

Hello @Sean-Der thank you very much! This seems to be another case of go-acc behaving slightly differently than go test, I couldn't reproduce it with go test locally. (Not surprising, since the output is not well documented.)

I have to apologize in advance, this will require some rearchitecting, so I can't fix it as quickly as I usually fix bugs.

I also wonder to myself if it wouldn't be easier to include code coverage reporting in gotestfmt itself.

@Sean-Der
Copy link
Author

@janosdebugs no worries here I am not blocked :) grep -v has me covered

Sean-Der added a commit to pion/transport that referenced this issue May 22, 2022
Sean-Der added a commit to pion/transport that referenced this issue May 22, 2022
Sean-Der added a commit to pion/transport that referenced this issue May 22, 2022
Sean-Der added a commit to pion/.goassets that referenced this issue May 22, 2022
Sean-Der added a commit to pion/transport that referenced this issue May 23, 2022
@lunemec
Copy link

lunemec commented Nov 17, 2022

👋 I ran into similar issue:

FAIL	service.../repositories/cache [build failed]

causes panic too.

Its ugly because it hides the actual fail, and you have to run it without gotestfmt. This is the exact message:

panic: unexpected output encountered: # service..../repositories/cache [service...../repositories/cache.test] (Did you use -json on go test?)

goroutine 7 [running]:
github.com/gotesttools/gotestfmt/v2/parser.parse(0x0?, 0xc000020660, 0xc0000206c0, 0xc000020720, 0xc000020780)
	/home/runner/go/pkg/mod/github.com/gotesttools/gotestfmt/[email protected]/parser/parse.go:166 +0x1125
created by github.com/gotesttools/gotestfmt/v2/parser.Parse
	/home/runner/go/pkg/mod/github.com/gotesttools/gotestfmt/[email protected]/parser/parse.go:26 +0x10a
make: *** [Makefile:62: test-go] Error 2

@ghost
Copy link

ghost commented Nov 17, 2022

Hello @lunemec can you please upload your go test -json output?

@lunemec
Copy link

lunemec commented Nov 17, 2022

Hi @janosdebugs - this is the output there. The issue was using Go 1.18 with sync/atomic.Int32 which is available on 1.19 and higher. Here is the output:

2022-11-17T16:01:43.4131591Z # repo/service/repositories/cache [repo/service/repositories/
cache.test]
2022-11-17T16:01:43.4214306Z ##[error]services/cache/repository_test.go:42:42: undefined: atomic.Int32
2022-11-17T16:01:43.4217841Z ##[error]services/cache/repository_test.go:57:38: undefined: atomic.Int32
2022-11-17T16:01:43.4221677Z ##[error]services/cache/repository_test.go:72:40: undefined: atomic.Int32
2022-11-17T16:01:43.4224680Z ##[error]services/cache/repository_test.go:87:42: undefined: atomic.Int32
2022-11-17T16:01:43.4227611Z ##[error]services/cache/repository_test.go:102:44: undefined: atomic.Int32
2022-11-17T16:01:43.4412163Z {"Time":"2022-11-17T16:01:43.440837459Z","Action":"run","Package":"repo/services/service","Test":"TestSuite/TestCase"}

@ghost
Copy link

ghost commented Nov 17, 2022

@lunemec do you have a custom TestMain defined that alters the output? This doesn't look like the typical output of go test -json, although I could be wrong.

@lunemec
Copy link

lunemec commented Nov 17, 2022

Yes, we use https://github.com/stretchr/testify#suite-package but that seems to work for everything - except this that is.

@ghost
Copy link

ghost commented Nov 17, 2022

Thank you, I'll try to reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants