mirror of https://github.com/ceph/go-ceph
rados: update test setup code to avoid blocking forever
When working on the previous rbd change it was determined that the connection setup code would block forever if the ceph config was missing or bad when running the tests. Adjust the connection setup in the rados pkg such that the tests will not block forever. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
3ec0541977
commit
d51628ca59
|
@ -31,9 +31,21 @@ func (suite *RadosTestSuite) SetupSuite() {
|
|||
require.NoError(suite.T(), err)
|
||||
defer conn.Shutdown()
|
||||
|
||||
conn.ReadDefaultConfigFile()
|
||||
err = conn.ReadDefaultConfigFile()
|
||||
require.NoError(suite.T(), err)
|
||||
|
||||
if err = conn.Connect(); assert.NoError(suite.T(), err) {
|
||||
timeout := time.After(time.Second * 5)
|
||||
ch := make(chan error)
|
||||
go func(conn *Conn) {
|
||||
ch <- conn.Connect()
|
||||
}(conn)
|
||||
select {
|
||||
case err = <-ch:
|
||||
case <-timeout:
|
||||
err = fmt.Errorf("timed out waiting for connect")
|
||||
}
|
||||
|
||||
if assert.NoError(suite.T(), err) {
|
||||
pool := uuid.Must(uuid.NewV4()).String()
|
||||
if err = conn.MakePool(pool); assert.NoError(suite.T(), err) {
|
||||
suite.pool = pool
|
||||
|
|
Loading…
Reference in New Issue