File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 5454def topics ():
5555 topics = ["test" , "foo" , "bar" ]
5656 admin_client = KafkaAdminClient (bootstrap_servers = [f"{ KAFKA_HOST } :9092" ])
57- admin_client .create_topics ([NewTopic (name , num_partitions = 1 , replication_factor = 1 ) for name in topics ])
57+ # since kafka-python 2.1.0 we started to get failures in create_topics because topics were already there despite
58+ # calls to delete_topics. In the meantime we found a proper fix use a big hammer and catch topics handling failures
59+ # https://github.com/dpkp/kafka-python/issues/2557
60+ try :
61+ admin_client .create_topics ([NewTopic (name , num_partitions = 1 , replication_factor = 1 ) for name in topics ])
62+ except Exception :
63+ pass
5864 yield topics
59- admin_client .delete_topics (topics )
65+ try :
66+ admin_client .delete_topics (topics )
67+ except Exception :
68+ pass
6069
6170
6271@pytest .fixture ()
You can’t perform that action at this time.
0 commit comments