1313# See the License for the specific language governing permissions and
1414# limitations under the License.
1515
16- import confluent_kafka
1716import struct
1817import time
19- from confluent_kafka import ConsumerGroupTopicPartitions , TopicPartition , ConsumerGroupState
18+
19+ from confluent_kafka import ConsumerGroupTopicPartitions , TopicPartition , ConsumerGroupState , KafkaError
2020from confluent_kafka .admin import (NewPartitions , ConfigResource ,
2121 AclBinding , AclBindingFilter , ResourceType ,
2222 ResourcePatternType , AclOperation , AclPermissionType )
@@ -55,6 +55,7 @@ def verify_admin_acls(admin_client,
5555 "User:test-user-2" , "*" , AclOperation .ALL , AclPermissionType .ALLOW )
5656
5757 fs = admin_client .create_acls ([acl_binding_1 , acl_binding_2 , acl_binding_3 ])
58+ time .sleep (1 )
5859 for acl_binding , f in fs .items ():
5960 f .result () # trigger exception if there was an error
6061
@@ -78,6 +79,7 @@ def verify_admin_acls(admin_client,
7879 #
7980 expected_acl_bindings = [acl_binding_2 , acl_binding_3 ]
8081 fs = admin_client .delete_acls ([acl_binding_filter2 ])
82+ time .sleep (1 )
8183 deleted_acl_bindings = sorted (fs [acl_binding_filter2 ].result ())
8284 assert deleted_acl_bindings == expected_acl_bindings , \
8385 "Deleted ACL bindings don't match, actual {} expected {}" .format (deleted_acl_bindings ,
@@ -89,6 +91,7 @@ def verify_admin_acls(admin_client,
8991 expected_acl_bindings = [[acl_binding_1 ], []]
9092 delete_acl_binding_filters = [acl_binding_filter3 , acl_binding_filter4 ]
9193 fs = admin_client .delete_acls (delete_acl_binding_filters )
94+ time .sleep (1 )
9295 for acl_binding , expected in zip (delete_acl_binding_filters , expected_acl_bindings ):
9396 deleted_acl_bindings = sorted (fs [acl_binding ].result ())
9497 assert deleted_acl_bindings == expected , \
@@ -209,6 +212,7 @@ def test_basic_operations(kafka_cluster):
209212 },
210213 validate_only = validate
211214 )
215+ time .sleep (1 )
212216
213217 admin_client = kafka_cluster .admin ()
214218
@@ -270,7 +274,7 @@ def consume_messages(group_id, num_messages=None):
270274 print ('Read all the required messages: exiting' )
271275 break
272276 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 :
274278 print ('Reached end of %s [%d] at offset %d' % (
275279 msg .topic (), msg .partition (), msg .offset ()))
276280 eof_reached [(msg .topic (), msg .partition ())] = True
@@ -343,6 +347,7 @@ def verify_config(expconfig, configs):
343347 resource .set_config (key , value )
344348
345349 fs = admin_client .alter_configs ([resource ])
350+ time .sleep (1 )
346351 fs [resource ].result () # will raise exception on failure
347352
348353 #
0 commit comments