Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix kafka: fix typings, fix too common netstat statistics grep #107

Merged
merged 7 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading