Skip to content

Commit

Permalink
Retry DropAll in txn test setup
Browse files Browse the repository at this point in the history
It fails sometimes in a way that seems like a timing issue - put a sleep
in before retrying (up to 3 attempts).
  • Loading branch information
babbageclunk committed Jul 6, 2016
1 parent 2a98e8c commit 6d88d84
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion txn/mgo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,16 @@ func (s *MgoSuite) TearDownSuite(c *C) {
}

func (s *MgoSuite) SetUpTest(c *C) {
err := DropAll(mgoaddr)
var err error
for attempt := 1; attempt < 4; attempt++ {
err = DropAll(mgoaddr)
if err != nil {
c.Logf("Retrying DropAll - attempt %v failed with %v", attempt, err)
time.Sleep(200 * time.Millisecond)
} else {
break
}
}
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 6d88d84

Please sign in to comment.