Skip to content

Commit

Permalink
Fix waiting for Kafka
Browse files Browse the repository at this point in the history
  • Loading branch information
Mátyás Kuti committed Nov 8, 2023
1 parent 724f1b8 commit c532cc8
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions tests/integration/utils/kafka_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
See LICENSE for details
"""
from dataclasses import dataclass
from kafka.errors import LeaderNotAvailableError, NoBrokersAvailable, UnrecognizedBrokerVersion
from kafka.errors import AuthenticationFailedError
from karapace.kafka_admin import KafkaAdminClient
from karapace.utils import Expiration
from pathlib import Path
Expand Down Expand Up @@ -51,21 +51,7 @@ def wait_for_kafka(
)
try:
KafkaAdminClient(bootstrap_servers=server).cluster_metadata()
# ValueError:
# - if the port number is invalid (i.e. not a number)
# - if the port is not bound yet
# NoBrokersAvailable:
# - if the address/port does not point to a running server
# LeaderNotAvailableError:
# - if there is no leader yet
# UnrecognizedBrokerVersion:
# - happens during start-up of dockerized Kafka
except (
NoBrokersAvailable,
LeaderNotAvailableError,
UnrecognizedBrokerVersion,
ValueError,
) as e:
except AuthenticationFailedError as e:
print(f"Error checking kafka cluster: {e}")
time.sleep(2.0)
else:
Expand Down

0 comments on commit c532cc8

Please sign in to comment.