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

BUG REPORT #119

Closed Icedroid closed 10 years ago

Icedroid commented 10 years ago
======= BEGIN BUG REPORT =======

ERROR: invalid character '/' after array element

OUTPUT: [2013/12/30 20:15:55 [T] testing TestLogin Code[%d]%v 200 &{0 {50033 Invalid json:} map[]}[DEBUG] [20:15:55] [GetSign @ Request.go.86] Before Enctypt string=Androidpassword=123456username=18312662735d41d8cd98f00b204e9800998ecgdfa8s[DEBUG] [20:15:55] [GetSign @ Request.go.94] After Enctypt string=1c55e2ce833df9bcea534ba477ad3bb0[ERROR] [20:15:55] [Prepare @ base.go.45] Unmarshal json error unexpected end of JSON input{"Title": "Subject: Test Station Endpoint\n","File": "/home/ice/Dropbox/mygo/src/mm/api/tests/user_test.go","Line": 52,"Depth": 0,"Assertions": []},{"Title": "Status Code Should Be 200","File": "/home/ice/Dropbox/mygo/src/mm/api/tests/user_test.go","Line": 48,"Depth": 1,"Assertions": [{"File": "/home/ice/Dropbox/mygo/src/mm/api/tests/user_test.go","Line": 47,"Expected": "","Actual": "","Failure": "","Error": null,"StackTrace": "goroutine 9 [running]:\nmm/api/tests.func·004()\n\u0009/home/ice/Dropbox/mygo/src/mm/api/tests/user_test.go:47 +0xb0\nmm/api/tests.TestLogin(0xc2100557e0)\n\u0009/home/ice/Dropbox/mygo/src/mm/api/tests/user_test.go:52 +0x98b\ntesting.tRunner(0xc2100557e0, 0xf51f38)\n\u0009/usr/local/go/src/pkg/testing/testing.go:391 +0x8b\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:471 +0x8b2\n\ngoroutine 1 [chan receive]:\ntesting.RunTests(0xa705f8, 0xf51f20, 0x2, 0x2, 0xc2100ed001)\n\u0009/usr/local/go/src/pkg/testing/testing.go:472 +0x8d5\ntesting.Main(0xa705f8, 0xf51f20, 0x2, 0x2, 0xf5df40, ...)\n\u0009/usr/local/go/src/pkg/testing/testing.go:403 +0x84\nmain.main()\n\u0009mm/api/tests/_test/_testmain.go:89 +0x11b\n\ngoroutine 3 [semacquire]:\nsync.runtime_Syncsemacquire(0xc210059f50)\n\u0009/usr/local/go/src/pkg/runtime/sema.goc:257 +0xca\nsync.(*Cond).Wait(0xc210059f40)\n\u0009/usr/local/go/src/pkg/sync/cond.go:62 +0x89\ngithub.com/cihub/seelog.(*asyncLoopLogger).processItem(0xc21003a720, 0x0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:50 +0x95\ngithub.com/cihub/seelog.(*asyncLoopLogger).processQueue(0xc21003a720)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:63 +0x31\ncreated by github.com/cihub/seelog.newAsyncLoopLogger\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:40 +0x74\n\ngoroutine 4 [semacquire]:\nsync.runtime_Syncsemacquire(0xc210059290)\n\u0009/usr/local/go/src/pkg/runtime/sema.goc:257 +0xca\nsync.(*Cond).Wait(0xc210059280)\n\u0009/usr/local/go/src/pkg/sync/cond.go:62 +0x89\ngithub.com/cihub/seelog.(*asyncLoopLogger).processItem(0xc21003a7e0, 0x0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:50 +0x95\ngithub.com/cihub/seelog.(*asyncLoopLogger).processQueue(0xc21003a7e0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:63 +0x31\ncreated by github.com/cihub/seelog.newAsyncLoopLogger\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:40 +0x74\n\ngoroutine 5 [runnable]:\nsync.runtime_Syncsemacquire(0xc2100599d0)\n\u0009/usr/local/go/src/pkg/runtime/sema.goc:257 +0xca\nsync.(*Cond).Wait(0xc2100599c0)\n\u0009/usr/local/go/src/pkg/sync/cond.go:62 +0x89\ngithub.com/cihub/seelog.(*asyncLoopLogger).processItem(0xc21003a8a0, 0x0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:50 +0x95\ngithub.com/cihub/seelog.(*asyncLoopLogger).processQueue(0xc21003a8a0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:63 +0x31\ncreated by github.com/cihub/seelog.newAsyncLoopLogger\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:40 +0x74\n\ngoroutine 6 [syscall]:\nos/signal.loop()\n\u0009/usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e\ncreated by os/signal.init·1\n\u0009/usr/local/go/src/pkg/os/signal/signal_unix.go:27 +0x31\n\ngoroutine 7 [runnable]:\ngithub.com/astaxie/beego/logs.(*BeeLogger).StartLogger(0xc2100781e0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/astaxie/beego/logs/log.go:106 +0x56\ncreated by github.com/astaxie/beego/logs.NewLogger\n\u0009/home/ice/Dropbox/mygo/src/github.com/astaxie/beego/logs/log.go:59 +0x89\n","Skipped": false}]},{"Title": "The Result Should Not Be Empty","File": "/home/ice/Dropbox/mygo/src/mm/api/tests/user_test.go","Line": 51,"Depth": 1,"Assertions": [{"File": "/home/ice/Dropbox/mygo/src/mm/api/tests/user_test.go","Line": 50,"Expected": "","Actual": "","Failure": "","Error": null,"StackTrace": "goroutine 9 [running]:\nmm/api/tests.func·005()\n\u0009/home/ice/Dropbox/mygo/src/mm/api/tests/user_test.go:50 +0xb8\nmm/api/tests.TestLogin(0xc2100557e0)\n\u0009/home/ice/Dropbox/mygo/src/mm/api/tests/user_test.go:52 +0x98b\ntesting.tRunner(0xc2100557e0, 0xf51f38)\n\u0009/usr/local/go/src/pkg/testing/testing.go:391 +0x8b\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:471 +0x8b2\n\ngoroutine 1 [chan receive]:\ntesting.RunTests(0xa705f8, 0xf51f20, 0x2, 0x2, 0xc2100ed001)\n\u0009/usr/local/go/src/pkg/testing/testing.go:472 +0x8d5\ntesting.Main(0xa705f8, 0xf51f20, 0x2, 0x2, 0xf5df40, ...)\n\u0009/usr/local/go/src/pkg/testing/testing.go:403 +0x84\nmain.main()\n\u0009mm/api/tests/_test/_testmain.go:89 +0x11b\n\ngoroutine 3 [semacquire]:\nsync.runtime_Syncsemacquire(0xc210059f50)\n\u0009/usr/local/go/src/pkg/runtime/sema.goc:257 +0xca\nsync.(*Cond).Wait(0xc210059f40)\n\u0009/usr/local/go/src/pkg/sync/cond.go:62 +0x89\ngithub.com/cihub/seelog.(*asyncLoopLogger).processItem(0xc21003a720, 0x0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:50 +0x95\ngithub.com/cihub/seelog.(*asyncLoopLogger).processQueue(0xc21003a720)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:63 +0x31\ncreated by github.com/cihub/seelog.newAsyncLoopLogger\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:40 +0x74\n\ngoroutine 4 [semacquire]:\nsync.runtime_Syncsemacquire(0xc210059290)\n\u0009/usr/local/go/src/pkg/runtime/sema.goc:257 +0xca\nsync.(*Cond).Wait(0xc210059280)\n\u0009/usr/local/go/src/pkg/sync/cond.go:62 +0x89\ngithub.com/cihub/seelog.(*asyncLoopLogger).processItem(0xc21003a7e0, 0x0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:50 +0x95\ngithub.com/cihub/seelog.(*asyncLoopLogger).processQueue(0xc21003a7e0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:63 +0x31\ncreated by github.com/cihub/seelog.newAsyncLoopLogger\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:40 +0x74\n\ngoroutine 5 [runnable]:\nsync.runtime_Syncsemacquire(0xc2100599d0)\n\u0009/usr/local/go/src/pkg/runtime/sema.goc:257 +0xca\nsync.(*Cond).Wait(0xc2100599c0)\n\u0009/usr/local/go/src/pkg/sync/cond.go:62 +0x89\ngithub.com/cihub/seelog.(*asyncLoopLogger).processItem(0xc21003a8a0, 0x0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:50 +0x95\ngithub.com/cihub/seelog.(*asyncLoopLogger).processQueue(0xc21003a8a0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:63 +0x31\ncreated by github.com/cihub/seelog.newAsyncLoopLogger\n\u0009/home/ice/Dropbox/mygo/src/github.com/cihub/seelog/behavior_asynclooplogger.go:40 +0x74\n\ngoroutine 6 [syscall]:\nos/signal.loop()\n\u0009/usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e\ncreated by os/signal.init·1\n\u0009/usr/local/go/src/pkg/os/signal/signal_unix.go:27 +0x31\n\ngoroutine 7 [runnable]:\ngithub.com/astaxie/beego/logs.(*BeeLogger).StartLogger(0xc2100781e0)\n\u0009/home/ice/Dropbox/mygo/src/github.com/astaxie/beego/logs/log.go:106 +0x56\ncreated by github.com/astaxie/beego/logs.NewLogger\n\u0009/home/ice/Dropbox/mygo/src/github.com/astaxie/beego/logs/log.go:59 +0x89\n","Skipped": false}]}]

======= END BUG REPORT =======
mdwhatcott commented 10 years ago

@Icedroid - Thanks for posting the report. Any chance you could also post some of the code that produced the report?

Icedroid commented 10 years ago

When I run goconvey, AppConfigPath= /tmp/go-build078948566/mm/api/tests/_test/conf/app.conf I use beego framework,the models have use the beego.AppConfig.String("key"), It get these error.

Icedroid commented 10 years ago

I frequently get these error when I run goconvey in my beego project dir:

2014/01/02 20:41:45 executor.go:56: Executor status: 'parsing'
Potential error parsing output of mm/api ; couldn't handle this stray line: go install mm/api/controllers: open /home/ice/Dropbox/mygo/pkg/linux_amd64/mm/api/controllers.a: permission denied
mdwhatcott commented 10 years ago

@Icedroid - Hmm, that's strange. I'm not familiar with beego. I'll experiment with it to see if I get similar errors. In the meantime, what output do you get when you run go test -v -timeout=-42s in your beego project directory? Can you paste that output here?

Icedroid commented 10 years ago

You can see this link https://github.com/astaxie/beego/issues/424

mdwhatcott commented 10 years ago

Can you create a simple example of the test code and production code you are trying to run and attach that as a comment here? It would be really helpful to have an example that I can execute to see if I see the error. If I can reproduce the error then I can probably fix it if the problem is with GoConvey. I can see some of your test code from that link you provided but the Chinese makes it difficult for me to understand the context (even with google translate).

If I were to guess what your test code was doing I would say that it is sending authentication information (username, password) to an HTTP handler. I've encountered problems in GoConvey when encrypted or hashed data is not escaped properly. Could that be the problem here? (I'm really guessing now)

Icedroid commented 10 years ago

You can try a golang simple function have a relative config file to read in. Like beego project, you can simply create a login method, and you must read from mysql, and then the mysql configure is from app.conf. When you run the goconvey or like go test, the tmp path will is /tmp/go-build078948566/mm/api/tests/_test/ so any configure file will not be readed.

mdwhatcott commented 10 years ago

Ah, now I understand the problem. Your configuration file isn't copied into the tmp directory created by go test. That's not something that GoConvey can help with because we integrate completely with go test. Is the config file read by beego or by the mysql process? Could you achieve the configuration you seek by using environment variables rather than a config file?

I'm going to close this issue as this issue is tied to go test, not GoConvey.

Icedroid commented 10 years ago

Thank-you for your attention reply. The config file is read by beego to connected mysql, but I don't know how to run my test for some associated mysql function? How to achieve mysql configuration for connected? How you run test in your project which have mysql or redis

mdwhatcott commented 10 years ago

That's a great question. Might be a good question for the golang-nuts user group.