Fixes for replicaset #117

Merged
merged 2 commits into from Nov 23, 2016

Conversation

Projects
None yet
4 participants
Contributor

macgreagoir commented Nov 22, 2016

replicaset tests seem not to have been passing for some time, and require these changes in mgo.go:

  • Add version 3.2 to the mongod paths
  • Reinstate MustDial() function

macgreagoir added some commits Nov 8, 2016

Reinstate MustDial
mgo.go MustDial was previously removed as unneeded, but is used in
replicaset tests.
Add version 3.2 to the mongod paths
In mgo.go, add verison 3.2 to the hard-coded slice of possible mongod
paths.

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" {
@frobware

frobware Nov 23, 2016

This seems incredibly fragile. What happens for 3.3? Do we have to release a new version of juju?

@jameinel

jameinel Nov 23, 2016

Owner

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)
@frobware

frobware Nov 23, 2016

Must this panic()?

@jameinel

jameinel Nov 23, 2016

Owner

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.

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)
@frobware

frobware Nov 23, 2016

Must this panic()?

@jameinel

jameinel Nov 23, 2016

Owner

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.

Contributor

macgreagoir commented Nov 23, 2016

$$merge$$

Contributor

jujubot commented Nov 23, 2016

@jujubot jujubot merged commit a95a7bc into juju:master Nov 23, 2016

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