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 )
@@ -58,6 +58,8 @@ def verify_admin_acls(admin_client,
5858 for acl_binding , f in fs .items ():
5959 f .result () # trigger exception if there was an error
6060
61+ time .sleep (1 )
62+
6163 acl_binding_filter1 = AclBindingFilter (ResourceType .ANY , None , ResourcePatternType .ANY ,
6264 None , None , AclOperation .ANY , AclPermissionType .ANY )
6365 acl_binding_filter2 = AclBindingFilter (ResourceType .ANY , None , ResourcePatternType .PREFIXED ,
@@ -83,6 +85,8 @@ def verify_admin_acls(admin_client,
8385 "Deleted ACL bindings don't match, actual {} expected {}" .format (deleted_acl_bindings ,
8486 expected_acl_bindings )
8587
88+ time .sleep (1 )
89+
8690 #
8791 # Delete the ACLs with TOPIC and GROUP
8892 #
@@ -94,6 +98,9 @@ def verify_admin_acls(admin_client,
9498 assert deleted_acl_bindings == expected , \
9599 "Deleted ACL bindings don't match, actual {} expected {}" .format (deleted_acl_bindings ,
96100 expected )
101+
102+ time .sleep (1 )
103+
97104 #
98105 # All the ACLs should have been deleted
99106 #
@@ -201,14 +208,14 @@ def test_basic_operations(kafka_cluster):
201208 # Second iteration: create topic.
202209 #
203210 for validate in (True , False ):
204- our_topic = kafka_cluster .create_topic (topic_prefix ,
205- {
206- "num_partitions" : num_partitions ,
207- "config" : topic_config ,
208- "replication_factor" : 1 ,
209- },
210- validate_only = validate
211- )
211+ our_topic = kafka_cluster .create_topic_and_wait_propogation (topic_prefix ,
212+ {
213+ "num_partitions" : num_partitions ,
214+ "config" : topic_config ,
215+ "replication_factor" : 1 ,
216+ },
217+ validate_only = validate
218+ )
212219
213220 admin_client = kafka_cluster .admin ()
214221
@@ -270,7 +277,7 @@ def consume_messages(group_id, num_messages=None):
270277 print ('Read all the required messages: exiting' )
271278 break
272279 except ConsumeError as e :
273- if msg is not None and e .code == confluent_kafka . KafkaError ._PARTITION_EOF :
280+ if msg is not None and e .code == KafkaError ._PARTITION_EOF :
274281 print ('Reached end of %s [%d] at offset %d' % (
275282 msg .topic (), msg .partition (), msg .offset ()))
276283 eof_reached [(msg .topic (), msg .partition ())] = True
@@ -345,6 +352,8 @@ def verify_config(expconfig, configs):
345352 fs = admin_client .alter_configs ([resource ])
346353 fs [resource ].result () # will raise exception on failure
347354
355+ time .sleep (1 )
356+
348357 #
349358 # Read the config back again and verify.
350359 #
0 commit comments