File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,11 @@ func TestControlConn_ReconnectRefreshesRing(t *testing.T) {
117117 }
118118 }
119119
120- pools := session .pool .hostConnPools
121- if len (pools ) != 0 {
122- return fmt .Errorf ("expected 0 connection pool but there were %v" , len (pools ))
120+ session .pool .mu .RLock ()
121+ poolsLen := len (session .pool .hostConnPools )
122+ session .pool .mu .RUnlock ()
123+ if poolsLen != 0 {
124+ return fmt .Errorf ("expected 0 connection pool but there were %v" , poolsLen )
123125 }
124126 return nil
125127 }
@@ -152,9 +154,11 @@ func TestControlConn_ReconnectRefreshesRing(t *testing.T) {
152154 return fmt .Errorf ("expected all hosts to be UP but %v isn't" , host .String ())
153155 }
154156 }
155- pools := session .pool .hostConnPools
156- if len (pools ) != len (allCcmHosts ) {
157- return fmt .Errorf ("expected %v connection pool but there were %v" , len (allCcmHosts ), len (pools ))
157+ session .pool .mu .RLock ()
158+ poolsLen := len (session .pool .hostConnPools )
159+ session .pool .mu .RUnlock ()
160+ if poolsLen != len (allCcmHosts ) {
161+ return fmt .Errorf ("expected %v connection pool but there were %v" , len (allCcmHosts ), poolsLen )
158162 }
159163 return nil
160164 }
You can’t perform that action at this time.
0 commit comments