Skip to content
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

Merged
merged 2 commits into from
Nov 23, 2016
Merged

Fixes for replicaset #117

merged 2 commits into from
Nov 23, 2016

Conversation

macgreagoir
Copy link
Contributor

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

Mick Gregg added 2 commits November 8, 2016 12:19
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.
Copy link

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

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?

Copy link
Member

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must this panic()?

Copy link
Member

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.

Copy link
Member

@jameinel jameinel left a 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)
Copy link
Member

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.

@macgreagoir
Copy link
Contributor Author

$$merge$$

@jujubot
Copy link
Contributor

jujubot commented Nov 23, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-testing

@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants