Skip to content

Commit

Permalink
fix kafka: fix typings, fix too common netstat statistics grep (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
fdr400 authored Oct 21, 2024
1 parent 291bbf3 commit 6466bef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions testsuite/databases/kafka/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def pytest_service_register(register_service):
async def _kafka_global_producer(
_kafka_service,
_bootstrap_servers,
) -> typing.AsyncGenerator[classes.KafkaConsumer, None]:
) -> typing.AsyncGenerator[classes.KafkaProducer, None]:
producer = classes.KafkaProducer(
enabled=_kafka_service,
bootstrap_servers=_bootstrap_servers,
Expand Down Expand Up @@ -73,7 +73,9 @@ async def _kafka_global_consumer(


@pytest.fixture
async def kafka_consumer(_kafka_global_consumer):
async def kafka_consumer(
_kafka_global_consumer,
) -> typing.AsyncGenerator[classes.KafkaConsumer, None]:
"""
Per test Kafka consumer instance.
Expand Down
4 changes: 2 additions & 2 deletions testsuite/databases/kafka/scripts/service-kafka
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ start_kafka() {
# In such keys, unexpectedly, testsuite server
# may start interfact with launched one without any errors.
# To avoid such cases, do not let the ports be binded by another applications at all.
if netstat --listening | grep $KAFKA_SERVER_PORT; then
if netstat --listening --tcp --numeric | awk '{print $4}' | grep $KAFKA_SERVER_PORT; then
echo "Maybe Kafka server is already running on the $KAFKA_SERVER_PORT port."
echo "Choose another port: specify TESTSUITE_KAFKA_SERVER_PORT environment variable."
exit 1
elif netstat --listening | grep $KAFKA_CONTROLLER_PORT; then
elif netstat --listening --tcp --numeric | awk '{print $4}' | grep $KAFKA_CONTROLLER_PORT; then
echo "Maybe Kafka controller is already running on the $KAFKA_CONTROLLER_PORT port."
echo "Choose another port: specify TESTSUITE_KAFKA_CONTROLLER_PORT environment variable."
exit 1
Expand Down

0 comments on commit 6466bef

Please sign in to comment.