-
Notifications
You must be signed in to change notification settings - Fork 230
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
Panic in dbtest #117
Comments
It looks like you didn't initialize a mgo.Session. |
I just executed the unit test Unit tests are supposed to be autonomous |
These are integration tests, which means they will use mongodb installed on the system. The exec.Cmd, invoking mongod, fails and wraps the error it gets in a panic. Initial exec.Cmd failing is at:
This is most likely a configuration issue on your testing machine, such as mongod not being on the path. Can you ensure mongod can be executed by the user running the test? The dbtest package is not used very much and we would welcome any contribution, that would make the test setup more robust/debuggable. |
Hi @nim-nim I'm going to close this because it sounds like @tadukurow has found the issue - feel free to reply if there's still something else happening though. Dom |
Hi @domodwyer ! I have the same problem. Mongo is actually in my $PATH but it does not seem to start mongo.
Thank you, |
I had figured it needed mongod in the path, and as you noted this is not sufficient As running mongod is a privileged operation on my system, I can't see how I could possibly run this test. |
@nim-nim, the dbtest package is used for creating integration tests in other test suites. @jtbonhomme, executing locally works for me, so it's probably some environment issue. I did find a test assertion error which is fixed in #122.
|
As seen in #117, dbtest start() throws a panic when it can't start mongo. This panic is picked up by a panichandler obscuring the actual problem. This PR simply prints the error start() encounters to stderr, before throwing the panic.
* Ignore dial error when server is stopped. related to #117 * Print dbtest server starting error before panic. As seen in #117, dbtest start() throws a panic when it can't start mongo. This panic is picked up by a panichandler obscuring the actual problem. This PR simply prints the error start() encounters to stderr, before throwing the panic.
Thank you, a clearer test failure certainly help (though the test should PASS when its prerequisites can't be set up) |
* Ignore dial error when server is stopped. related to globalsign#117 * Print dbtest server starting error before panic. As seen in globalsign#117, dbtest start() throws a panic when it can't start mongo. This panic is picked up by a panichandler obscuring the actual problem. This PR simply prints the error start() encounters to stderr, before throwing the panic.
While running unit tests with go 1.9.4 on x86_64 for release 2018.02.20
A unit test should always just work with go test and report sensible results
The text was updated successfully, but these errors were encountered: