Merge lp:~axwalk/juju-core/lp1097556-mongod-failure-hangs-tests into lp:~go-bot/juju-core/trunk
Proposed by
Andrew Wilkins
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Andrew Wilkins | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 1569 | ||||
Proposed branch: | lp:~axwalk/juju-core/lp1097556-mongod-failure-hangs-tests | ||||
Merge into: | lp:~go-bot/juju-core/trunk | ||||
Diff against target: |
22 lines (+5/-0) 1 file modified
testing/mgo.go (+5/-0) |
||||
To merge this branch: | bzr merge lp:~axwalk/juju-core/lp1097556-mongod-failure-hangs-tests | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email:
|
Commit message
Prevent testing.MgoDial from hanging tests.
Add timeout to testing.MgoDial, so if mongod
fails, MgoDial doesn't block forever.
Description of the change
Prevent testing.MgoDial from hanging tests.
Add timeout to testing.MgoDial, so if mongod
fails, MgoDial doesn't block forever.
To post a comment you must log in.
Reviewers: mp+177752_ code.launchpad. net,
Message:
Please take a look.
Description:
Prevent testing.MgoDial from hanging tests.
Add timeout to testing.MgoDial, so if mongod
fails, MgoDial doesn't block forever.
https:/ /code.launchpad .net/~axwalk/ juju-core/ lp1097556- mongod- failure- hangs-tests/ +merge/ 177752
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/12150043/
Affected files:
A [revision details]
M testing/mgo.go
Index: [revision details] 20130731041121- ner0j2mn53rh64d 7
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: testing/mgo.go
=== modified file 'testing/mgo.go'
--- testing/mgo.go 2013-07-09 10:32:23 +0000
+++ testing/mgo.go 2013-07-31 08:17:33 +0000
@@ -42,6 +42,10 @@
mgoDir string
)
+// We specify a timeout to mgo.Dial, to prevent
+// mongod failures hanging the tests.
+const mgoDialTimeout = 5 * time.Second
+
// MgoSuite is a suite that deletes all content from the shared MongoDB
// server at the end of every test and supplies a connection to the shared
// MongoDB server.
@@ -183,6 +187,7 @@
Dial: func(addr net.Addr) (net.Conn, error) {
return tls.Dial("tcp", addr.String(), tlsConfig)
},
+ Timeout: mgoDialTimeout,
})
if err != nil {
panic(err)