smartystreets / goconvey

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
http://smartystreets.github.io/goconvey/
Other
8.25k stars 555 forks source link

"???" in web UI output upon certain errors/failures #288

Open mdwhatcott opened 9 years ago

mdwhatcott commented 9 years ago

Encountered this bug (which other users had reported to me) at this commit for our metrics project:

https://github.com/smartystreets/metrics/commit/8f0d4239834ee0acdf9a4c1a971201884682f6f5

The "???" is caused by the UI because it's received JSON that it doesn't know what to do with. So this is definitely a server side problem.

andrewaustin commented 9 years ago

I ran into this issue today. My issue was caused by not passing a *testing.T to the Convey, something like:

 Convey(".Save()", func() {
   DeleteAllCampaignsForTesting()
    Convey("Inserts new data into the database and sets Id", func() {
    // snip
    })
})

When the first line should be:

Convey(".Save()", t, func() {
mdwhatcott commented 9 years ago

Thanks for the report @andrewaustin -- I think this issue is related to #229.

andrewaustin commented 9 years ago

I'm having a weird but seemingly related problem...

When I run GoConvey I run GoConvey using the web UI I get the "???" issue as referenced above, except, looking at the JSON I get the following as the error field (I couldn't find a clean way to parse it as it's not valid JSON):

">->->OPEN-JSON->->->{ "Title": "Package Init", "File": "/home/andrew/code/go/src/bitbucket.org/andrewaustin/peerreview/models/models_test.go", /usr/local/go/src/testing/testing.go:681 +0x12f "Depth": 1, /usr/local/go/src/time/sleep.go:129 +0x4b { "File": "", "Line": 0, /usr/local/go/src/testing/testing.go:556 +0xad6 "Actual": "", /usr/local/go/src/testing/testing.go:485 +0x6c "Error": null, bitbucket.org/andrewaustin/peerreview/models/_test/_testmain.go:104 +0x291 "Skipped": false } ], /usr/local/go/src/database/sql/sql.go:589 +0x4c}, /usr/local/go/src/database/sql/sql.go:452 +0x31cpanic: test timed out after 5sgoroutine 9 [running]:testing.func·008()/usr/local/go/src/testing/testing.go:681 +0x12f /home/andrew/code/go/src/golang.org/x/crypto/bcrypt/bcrypt.go:227 +0x284/usr/local/go/src/time/sleep.go:129 +0x4b /home/andrew/code/go/src/golang.org/x/crypto/bcrypt/bcrypt.go:190 +0x166goroutine 1 [chan receive]: /home/andrew/code/go/src/golang.org/x/crypto/bcrypt/bcrypt.go:150 +0x277/usr/local/go/src/testing/testing.go:556 +0xad6 /home/andrew/code/go/src/golang.org/x/crypto/bcrypt/bcrypt.go:89 +0x7c/usr/local/go/src/testing/testing.go:485 +0x6c bitbucket.org/andrewaustin/peerreview/models/_test/_obj_test/user.go:124 +0x95bitbucket.org/andrewaustin/peerreview/models/_test/_testmain.go:104 +0x291 bitbucket.org/andrewaustin/peerreview/models/_test/_obj_test/user.go:54 +0x82goroutine 5 [chan receive]: /home/andrew/code/go/src/bitbucket.org/andrewaustin/peerreview/models/models_test.go:79 +0x136/usr/local/go/src/database/sql/sql.go:589 +0x4c /home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x22/usr/local/go/src/database/sql/sql.go:452 +0x31c /home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x27fgoroutine 8 [runnable]: /home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/context.go:110 +0x157/home/andrew/code/go/src/golang.org/x/crypto/blowfish/block.go:28 /home/andrew/code/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x32/home/andrew/code/go/src/golang.org/x/crypto/bcrypt/bcrypt.go:227 +0x284 /home/andrew/code/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x32/home/andrew/code/go/src/golang.org/x/crypto/bcrypt/bcrypt.go:190 +0x166 /home/andrew/code/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x3e/home/andrew/code/go/src/golang.org/x/crypto/bcrypt/bcrypt.go:150 +0x277 /home/andrew/code/go/src/github.com/jtolds/gls/context.go:98 +0x503/home/andrew/code/go/src/golang.org/x/crypto/bcrypt/bcrypt.go:89 +0x7c /home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/context.go:113 +0x486bitbucket.org/andrewaustin/peerreview/models/_test/_obj_test/user.go:124 +0x95 /home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/doc.go:73 +0x4cbitbucket.org/andrewaustin/peerreview/models/_test/_obj_test/user.go:54 +0x82 /home/andrew/code/go/src/bitbucket.org/andrewaustin/peerreview/models/models_test.go:113 +0x28c/home/andrew/code/go/src/bitbucket.org/andrewaustin/peerreview/models/models_test.go:79 +0x136 /usr/local/go/src/testing/testing.go:447 +0xbf/home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/discovery.go:80 +0x22 /usr/local/go/src/testing/testing.go:555 +0xa8b/home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/context.go:261 +0x27fgithub.com/smartystreets/goconvey/convey.func·001()/home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/context.go:110 +0x157 /usr/local/go/src/runtime/asm_amd64.s:2232 +0x1/home/andrew/code/go/src/github.com/jtolds/gls/stack_tags.go:70 +0x32github.com/jtolds/gls.markS(0x0, 0xc20801d0a0)/home/andrew/code/go/src/github.com/jtolds/gls/stack_tags.go:21 +0x32github.com/jtolds/gls.addStackTag(0x0, 0xc20801d0a0)/home/andrew/code/go/src/github.com/jtolds/gls/stack_tags.go:18 +0x3egithub.com/jtolds/gls.(*ContextManager).SetValues(0xc20801c0e0, 0xc20803b9b0, 0xc20801d0a0)/home/andrew/code/go/src/github.com/jtolds/gls/context.go:98 +0x503github.com/smartystreets/goconvey/convey.rootConvey(0xc2080c5f40, 0x3, 0x3)/home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/context.go:113 +0x486github.com/smartystreets/goconvey/convey.Convey(0xc2080c5f40, 0x3, 0x3)/home/andrew/code/go/src/github.com/smartystreets/goconvey/convey/doc.go:73 +0x4cbitbucket.org/andrewaustin/peerreview/models.TestCampaignModel(0xc20805e630)/home/andrew/code/go/src/bitbucket.org/andrewaustin/peerreview/models/models_test.go:113 +0x28ctesting.tRunner(0xc20805e630, 0x8eacb8)/usr/local/go/src/testing/testing.go:447 +0xbfcreated by testing.RunTests/usr/local/go/src/testing/testing.go:555 +0xa8bgoroutine 17 [syscall, locked to thread]:runtime.goexit()/usr/local/go/src/runtime/asm_amd64.s:2232 +0x1"

It's not clear to me why there is a panic, but running things via the command line with go test works wonderfully:

.
1 assertion thus far

.
2 assertions thus far

........
10 assertions thus far

..
12 assertions thus far

.
13 assertions thus far

.............
26 assertions thus far

....
35 assertions thus far

PASS
ok      bitbucket.org/andrewaustin/peerreview/models    1.443s
mdwhatcott commented 9 years ago

@andrewaustin - Yeah it's weird. The good news is that I have a test case the reproduces the behavior and I know I can fix it. I've been focusing on other projects for now. Sorry for the frustrating situation!