Skip to content

Commit

Permalink
Merge pull request juju#6190 from howbazaar/retry-dummy-reset
Browse files Browse the repository at this point in the history
Another attempt to catch the unexpected message.

mgo.Dial was only one place we found unexpected messages.
Resetting the dummy provider also occasionally fails.

(Review request: http://reviews.vapour.ws/r/5626/)
  • Loading branch information
jujubot authored Sep 8, 2016
2 parents 3066c25 + f79e051 commit d3e3c71
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion provider/dummy/environs.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ import (

"github.com/juju/errors"
"github.com/juju/loggo"
"github.com/juju/retry"
"github.com/juju/schema"
gitjujutesting "github.com/juju/testing"
jc "github.com/juju/testing/checkers"
"github.com/juju/utils/arch"
"github.com/juju/utils/clock"
"github.com/juju/utils/series"
gc "gopkg.in/check.v1"
"gopkg.in/juju/environschema.v1"
Expand Down Expand Up @@ -310,7 +312,17 @@ func Reset(c *gc.C) {
s.destroy()
}
if mongoAlive() {
err := gitjujutesting.MgoServer.Reset()
err := retry.Call(retry.CallArgs{
Func: gitjujutesting.MgoServer.Reset,
// Only interested in retrying the intermittent
// 'unexpected message'.
IsFatalError: func(err error) bool {
return !strings.HasSuffix(err.Error(), "unexpected message")
},
Delay: time.Millisecond,
Clock: clock.WallClock,
Attempts: 5,
})
c.Assert(err, jc.ErrorIsNil)
}
}
Expand Down

0 comments on commit d3e3c71

Please sign in to comment.