Merge pull request #10005 from id/ci-try-to-fix-flaky-kafka

ci: fix flaky kafka tests
This commit is contained in:
Ivan Dyachkov 2023-02-20 23:36:43 +01:00 committed by GitHub
commit 67f88f27fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 8 deletions

View File

@ -39,9 +39,12 @@ services:
container_name: kafka-1.emqx.net container_name: kafka-1.emqx.net
hostname: kafka-1.emqx.net hostname: kafka-1.emqx.net
depends_on: depends_on:
- "kdc" kdc:
- "zookeeper" condition: service_started
- "ssl_cert_gen" zookeeper:
condition: service_started
ssl_cert_gen:
condition: service_completed_successfully
environment: environment:
KAFKA_BROKER_ID: 1 KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
@ -52,7 +55,7 @@ services:
KAFKA_SASL_ENABLED_MECHANISMS: PLAIN,SCRAM-SHA-256,SCRAM-SHA-512,GSSAPI KAFKA_SASL_ENABLED_MECHANISMS: PLAIN,SCRAM-SHA-256,SCRAM-SHA-512,GSSAPI
KAFKA_SASL_KERBEROS_SERVICE_NAME: kafka KAFKA_SASL_KERBEROS_SERVICE_NAME: kafka
KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN
KAFKA_JMX_OPTS: "-Djava.security.auth.login.config=/etc/kafka/jaas.conf" KAFKA_OPTS: "-Djava.security.auth.login.config=/etc/kafka/jaas.conf"
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
KAFKA_CREATE_TOPICS_NG: test-topic-one-partition:1:1,test-topic-two-partitions:2:1,test-topic-three-partitions:3:1, KAFKA_CREATE_TOPICS_NG: test-topic-one-partition:1:1,test-topic-two-partitions:2:1,test-topic-three-partitions:3:1,
KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.auth.SimpleAclAuthorizer KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.auth.SimpleAclAuthorizer

View File

@ -277,6 +277,9 @@ kafka_bridge_rest_api_helper(Config) ->
}, },
<<"kafka">> => #{ <<"kafka">> => #{
<<"topic">> => erlang:list_to_binary(KafkaTopic), <<"topic">> => erlang:list_to_binary(KafkaTopic),
<<"buffer">> => #{
<<"memory_overload_protection">> => <<"false">>
},
<<"message">> => #{ <<"message">> => #{
<<"key">> => <<"${clientid}">>, <<"key">> => <<"${clientid}">>,
<<"value">> => <<"${.payload}">> <<"value">> => <<"${.payload}">>
@ -384,6 +387,13 @@ t_failed_creation_then_fix(Config) ->
"kafka_hosts_string" => HostsString, "kafka_hosts_string" => HostsString,
"kafka_topic" => KafkaTopic, "kafka_topic" => KafkaTopic,
"instance_id" => ResourceId, "instance_id" => ResourceId,
"producer" => #{
"kafka" => #{
"buffer" => #{
"memory_overload_protection" => false
}
}
},
"ssl" => #{} "ssl" => #{}
}), }),
%% creates, but fails to start producers %% creates, but fails to start producers
@ -577,6 +587,9 @@ producer = {
topic = \"{{ kafka_topic }}\" topic = \"{{ kafka_topic }}\"
message = {key = \"${clientid}\", value = \"${.payload}\"} message = {key = \"${clientid}\", value = \"${.payload}\"}
partition_strategy = {{ partition_strategy }} partition_strategy = {{ partition_strategy }}
buffer = {
memory_overload_protection = false
}
} }
} }
""". """.

View File

@ -201,7 +201,7 @@ if [ "$STOP" = 'no' ]; then
# some left-over log file has to be deleted before a new docker-compose up # some left-over log file has to be deleted before a new docker-compose up
rm -f '.ci/docker-compose-file/redis/*.log' rm -f '.ci/docker-compose-file/redis/*.log'
# shellcheck disable=2086 # no quotes for F_OPTIONS # shellcheck disable=2086 # no quotes for F_OPTIONS
docker-compose $F_OPTIONS up -d --build --remove-orphans docker compose $F_OPTIONS up -d --build --remove-orphans
fi fi
echo "Fixing file owners and permissions for $UID_GID" echo "Fixing file owners and permissions for $UID_GID"
@ -218,7 +218,7 @@ set +e
if [ "$STOP" = 'yes' ]; then if [ "$STOP" = 'yes' ]; then
# shellcheck disable=2086 # no quotes for F_OPTIONS # shellcheck disable=2086 # no quotes for F_OPTIONS
docker-compose $F_OPTIONS down --remove-orphans docker compose $F_OPTIONS down --remove-orphans
elif [ "$ATTACH" = 'yes' ]; then elif [ "$ATTACH" = 'yes' ]; then
docker exec -it "$ERLANG_CONTAINER" bash docker exec -it "$ERLANG_CONTAINER" bash
elif [ "$CONSOLE" = 'yes' ]; then elif [ "$CONSOLE" = 'yes' ]; then
@ -235,11 +235,11 @@ else
LOG='_build/test/logs/docker-compose.log' LOG='_build/test/logs/docker-compose.log'
echo "Dumping docker-compose log to $LOG" echo "Dumping docker-compose log to $LOG"
# shellcheck disable=2086 # no quotes for F_OPTIONS # shellcheck disable=2086 # no quotes for F_OPTIONS
docker-compose $F_OPTIONS logs --no-color --timestamps > "$LOG" docker compose $F_OPTIONS logs --no-color --timestamps > "$LOG"
fi fi
if [ "$KEEP_UP" != 'yes' ]; then if [ "$KEEP_UP" != 'yes' ]; then
# shellcheck disable=2086 # no quotes for F_OPTIONS # shellcheck disable=2086 # no quotes for F_OPTIONS
docker-compose $F_OPTIONS down docker compose $F_OPTIONS down
fi fi
exit $RESULT exit $RESULT
fi fi