13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
16
- import confluent_kafka
17
16
import struct
18
17
import time
19
- from confluent_kafka import ConsumerGroupTopicPartitions , TopicPartition , ConsumerGroupState
18
+
19
+ from confluent_kafka import ConsumerGroupTopicPartitions , TopicPartition , ConsumerGroupState , KafkaError
20
20
from confluent_kafka .admin import (NewPartitions , ConfigResource ,
21
21
AclBinding , AclBindingFilter , ResourceType ,
22
22
ResourcePatternType , AclOperation , AclPermissionType )
@@ -55,6 +55,7 @@ def verify_admin_acls(admin_client,
55
55
"User:test-user-2" , "*" , AclOperation .ALL , AclPermissionType .ALLOW )
56
56
57
57
fs = admin_client .create_acls ([acl_binding_1 , acl_binding_2 , acl_binding_3 ])
58
+ time .sleep (1 )
58
59
for acl_binding , f in fs .items ():
59
60
f .result () # trigger exception if there was an error
60
61
@@ -78,6 +79,7 @@ def verify_admin_acls(admin_client,
78
79
#
79
80
expected_acl_bindings = [acl_binding_2 , acl_binding_3 ]
80
81
fs = admin_client .delete_acls ([acl_binding_filter2 ])
82
+ time .sleep (1 )
81
83
deleted_acl_bindings = sorted (fs [acl_binding_filter2 ].result ())
82
84
assert deleted_acl_bindings == expected_acl_bindings , \
83
85
"Deleted ACL bindings don't match, actual {} expected {}" .format (deleted_acl_bindings ,
@@ -89,6 +91,7 @@ def verify_admin_acls(admin_client,
89
91
expected_acl_bindings = [[acl_binding_1 ], []]
90
92
delete_acl_binding_filters = [acl_binding_filter3 , acl_binding_filter4 ]
91
93
fs = admin_client .delete_acls (delete_acl_binding_filters )
94
+ time .sleep (1 )
92
95
for acl_binding , expected in zip (delete_acl_binding_filters , expected_acl_bindings ):
93
96
deleted_acl_bindings = sorted (fs [acl_binding ].result ())
94
97
assert deleted_acl_bindings == expected , \
@@ -209,6 +212,7 @@ def test_basic_operations(kafka_cluster):
209
212
},
210
213
validate_only = validate
211
214
)
215
+ time .sleep (1 )
212
216
213
217
admin_client = kafka_cluster .admin ()
214
218
@@ -270,7 +274,7 @@ def consume_messages(group_id, num_messages=None):
270
274
print ('Read all the required messages: exiting' )
271
275
break
272
276
except ConsumeError as e :
273
- if msg is not None and e .code == confluent_kafka . KafkaError ._PARTITION_EOF :
277
+ if msg is not None and e .code == KafkaError ._PARTITION_EOF :
274
278
print ('Reached end of %s [%d] at offset %d' % (
275
279
msg .topic (), msg .partition (), msg .offset ()))
276
280
eof_reached [(msg .topic (), msg .partition ())] = True
@@ -343,6 +347,7 @@ def verify_config(expconfig, configs):
343
347
resource .set_config (key , value )
344
348
345
349
fs = admin_client .alter_configs ([resource ])
350
+ time .sleep (1 )
346
351
fs [resource ].result () # will raise exception on failure
347
352
348
353
#
0 commit comments