File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ def test_auth_connect(self):
93
93
session = cluster .connect ()
94
94
try :
95
95
self .assertTrue (session .execute ('SELECT release_version FROM system.local' ))
96
- assert_quiescent_pool_state (self , cluster )
96
+ assert_quiescent_pool_state (self , cluster , wait = 1 )
97
97
for pool in session .get_pools ():
98
98
connection , _ = pool .borrow_connection (timeout = 0 )
99
99
self .assertEqual (connection .authenticator .server_authenticator_class , 'org.apache.cassandra.auth.PasswordAuthenticator' )
@@ -102,7 +102,7 @@ def test_auth_connect(self):
102
102
cluster .shutdown ()
103
103
finally :
104
104
root_session .execute ('DROP USER %s' , user )
105
- assert_quiescent_pool_state (self , root_session .cluster )
105
+ assert_quiescent_pool_state (self , root_session .cluster , wait = 1 )
106
106
root_session .cluster .shutdown ()
107
107
108
108
def test_connect_wrong_pwd (self ):
Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
from tests .integration import PROTOCOL_VERSION
16
+ import time
16
17
17
- def assert_quiescent_pool_state (test_case , cluster ):
18
+
19
+ def assert_quiescent_pool_state (test_case , cluster , wait = None ):
20
+ """
21
+ Checking the quiescent pool state checks that none of the requests ids have
22
+ been lost. However, the callback corresponding to a request_id is called
23
+ before the request_id is returned back to the pool, therefore
24
+
25
+ session.execute("SELECT * from system.local")
26
+ assert_quiescent_pool_state(self, session.cluster)
27
+
28
+ (with no wait) might fail because when execute comes back the request_id
29
+ hasn't yet been returned to the pool, therefore the wait.
30
+ """
31
+ if wait is not None :
32
+ time .sleep (wait )
18
33
19
34
for session in cluster .sessions :
20
35
pool_states = session .get_pool_state ().values ()
@@ -34,4 +49,3 @@ def assert_quiescent_pool_state(test_case, cluster):
34
49
test_case .assertEqual (connection .highest_request_id , max (req_ids ))
35
50
if PROTOCOL_VERSION < 3 :
36
51
test_case .assertEqual (connection .highest_request_id , connection .max_request_id )
37
-
You can’t perform that action at this time.
0 commit comments