File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 1
1
import logging
2
2
import uuid
3
+ import time
3
4
4
5
import pytest
5
6
@@ -69,12 +70,17 @@ def test_client(request, sasl_kafka):
69
70
70
71
client , = sasl_kafka .get_clients (1 )
71
72
request = MetadataRequest_v1 (None )
72
- client .send (0 , request )
73
- for _ in range (10 ):
74
- result = client .poll (timeout_ms = 10000 )
75
- if len (result ) > 0 :
76
- break
77
- else :
73
+ timeout_at = time .time () + 1
74
+ while not client .is_ready (0 ):
75
+ client .maybe_connect (0 )
76
+ client .poll (timeout_ms = 100 )
77
+ if time .time () > timeout_at :
78
+ raise RuntimeError ("Couldn't connect to node 0" )
79
+ future = client .send (0 , request )
80
+ client .poll (future = future , timeout_ms = 10000 )
81
+ if not future .is_done :
78
82
raise RuntimeError ("Couldn't fetch topic response from Broker." )
79
- result = result [0 ]
83
+ elif future .failed ():
84
+ raise future .exception
85
+ result = future .value
80
86
assert topic_name in [t [1 ] for t in result .topics ]
You can’t perform that action at this time.
0 commit comments