-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fixes for replicaset #117
Fixes for replicaset #117
Conversation
mgo.go MustDial was previously removed as unneeded, but is used in replicaset tests.
In mgo.go, add verison 3.2 to the hard-coded slice of possible mongod paths.
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.
LGTM apart from the panic().
@@ -248,7 +248,7 @@ func (inst *MgoInstance) run() error { | |||
return err | |||
} | |||
logger.Debugf("found mongod at: %q", mongopath) | |||
if mongopath == "/usr/lib/juju/bin/mongod" { | |||
if mongopath == "/usr/lib/juju/bin/mongod" || mongopath == "/usr/lib/juju/mongo3.2/bin/mongod" { |
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.
This seems incredibly fragile. What happens for 3.3? Do we have to release a new version of juju?
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.
Given the differences in 2.4 vs 2.6 we weren't able to support them generically even with simple version changes. So we decided to explicitly version the mongo directory, so that new versions of Juju don't accidentally get a version of Mongo that they can't actually support.
Since we have to do work to enable Mongo anyway, we'd have to release new versions to get new Mongo. (btw, Mongo uses even/odd for stable/unstable, so we'll never do 3.3, but certainly we should be aware of what 3.4 might bring.)
func (inst *MgoInstance) MustDial() *mgo.Session { | ||
s, err := mgo.DialWithInfo(inst.DialInfo()) | ||
if err != nil { | ||
panic(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.
Must this panic()
?
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.
It is generally standard practice for a "MustX" function to panic if it cannot do X. I don't know why we need MustDial, rather than actually handling the error. As this is Testing infrastructure, I suppose it is ok, but I will note that failing an assertion is often much easier to debug than a panic.
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.
changes seem fine to me. they are a bit unfortunate, but not incorrect.
func (inst *MgoInstance) MustDial() *mgo.Session { | ||
s, err := mgo.DialWithInfo(inst.DialInfo()) | ||
if err != nil { | ||
panic(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.
It is generally standard practice for a "MustX" function to panic if it cannot do X. I don't know why we need MustDial, rather than actually handling the error. As this is Testing infrastructure, I suppose it is ok, but I will note that failing an assertion is often much easier to debug than a panic.
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-testing |
replicaset tests seem not to have been passing for some time, and require these changes in mgo.go: