github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/mongo/mongotest/opts.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package mongotest 5 6 import ( 7 "time" 8 9 "github.com/juju/juju/mongo" 10 ) 11 12 const ( 13 DialTimeout = 5 * time.Minute 14 SocketTimeout = DialTimeout 15 ) 16 17 // DialOpts returns mongo.DialOpts suitable for use in tests that operate 18 // against a real MongoDB server. The timeouts are chosen to avoid failures 19 // caused by slow I/O; we do not expect the timeouts to be reached under 20 // normal circumstances. 21 func DialOpts() mongo.DialOpts { 22 return mongo.DialOpts{ 23 Timeout: DialTimeout, 24 SocketTimeout: SocketTimeout, 25 } 26 }