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: kafkacat is called with kcat, shellcheck formatting #6887

Merged
merged 1 commit into from
Aug 6, 2024
Merged
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
35 changes: 18 additions & 17 deletions ci/tasks/galoy-deps-smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF > topic.tf
cat <<EOF >topic.tf
provider "kafka" {
bootstrap_servers = [
"${kafka_service_name_prefix}-0.${kafka_namespace}:9092",
Expand All @@ -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
Expand All @@ -49,23 +48,25 @@ 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

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
Loading