From c247927ece517186e7c760502f2c9a373b7af385 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:54:09 +0200 Subject: [PATCH] fix: kafkacat is called with kcat, shellcheck formatting (#6887) --- ci/tasks/galoy-deps-smoketest.sh | 35 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/ci/tasks/galoy-deps-smoketest.sh b/ci/tasks/galoy-deps-smoketest.sh index 08e645b1f2..5e5451fe2c 100755 --- a/ci/tasks/galoy-deps-smoketest.sh +++ b/ci/tasks/galoy-deps-smoketest.sh @@ -4,15 +4,15 @@ set -eu source smoketest-settings/helpers.sh -kafka_broker_host=`setting "kafka_broker_endpoint"` -kafka_broker_port=`setting "kafka_broker_port"` -kafka_topic=`setting "smoketest_topic"` +kafka_broker_host=$(setting "kafka_broker_endpoint") +kafka_broker_port=$(setting "kafka_broker_port") +kafka_topic=$(setting "smoketest_topic") kafka_service_name_prefix="kafka-kafka-plain" -kafka_namespace=`setting "kafka_namespace"` -setting "smoketest_kubeconfig" | base64 --decode > kubeconfig.json +kafka_namespace=$(setting "kafka_namespace") +setting "smoketest_kubeconfig" | base64 --decode >kubeconfig.json export KUBECONFIG=$(pwd)/kubeconfig.json -cat < topic.tf +cat <topic.tf provider "kafka" { bootstrap_servers = [ "${kafka_service_name_prefix}-0.${kafka_namespace}:9092", @@ -32,15 +32,14 @@ terraform { } resource "kafka_topic" "smoketest_topic" { - name = "${kafka_topic}" - replication_factor = 3 - partitions = 3 + name = "${kafka_topic}" + replication_factor = 3 + partitions = 3 } EOF set +e -for i in 1 2 3 -do +for i in 1 2 3; do kubectl -n $kafka_namespace wait --for=condition=Ready pod -l strimzi.io/component-type=kafka && break sleep 5 done @@ -49,8 +48,7 @@ set -e terraform init set +e -for i in 1 2 3 -do +for i in 1 2 3; do terraform apply -auto-approve && break sleep 5 done @@ -58,14 +56,17 @@ done msg="kafka message" for i in {1..15}; do echo "Attempt ${i} to produce and consume from kafka" - echo $msg | kafkacat -P -b $kafka_broker_host:$kafka_broker_port -t $kafka_topic - consumed_message=$(kafkacat -C -b $kafka_broker_host:$kafka_broker_port -t $kafka_topic -e) - if [[ "$consumed_message" == "$msg" ]]; then success="true"; break; fi; + echo $msg | kcat -P -b $kafka_broker_host:$kafka_broker_port -t $kafka_topic + consumed_message=$(kcat -C -b $kafka_broker_host:$kafka_broker_port -t $kafka_topic -e) + if [[ "$consumed_message" == "$msg" ]]; then + success="true" + break + fi sleep 1 done terraform destroy -auto-approve -if [[ "$success" != "true" ]]; then echo "Smoke test failed" && exit 1; fi; +if [[ "$success" != "true" ]]; then echo "Smoke test failed" && exit 1; fi set -e