Skip to content

Commit 1f6be9d

Browse files
authored
Update kafka_test_setup.sh to have better curl flags
``` --fail \ # -f: exit non-zero on HTTP ≥ 400 --show-error \ # -S: print error messages even if “silent” --no-progress-meter\ # disable progress meter (but not error output) --location \ # -L: follow redirects --retry 3 \ # retry up to 3 times on transient errors --retry-delay 5 \ # wait 5 s between retries ```
1 parent e462ab5 commit 1f6be9d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

kafka_test_setup.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ fi
1111

1212
export _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"
1313

14+
export CURL_OPTS="--fail --show-error --no-progress-meter --location --retry 3 --retry-delay 5"
15+
1416
rm -rf build
1517
mkdir build
1618

1719
echo "Setup Kafka version $KAFKA_VERSION"
1820
if [ ! -e "kafka_2.13-$KAFKA_VERSION.tgz" ]; then
1921
echo "Kafka not present locally, downloading"
20-
curl -s -o "kafka_2.13-$KAFKA_VERSION.tgz" "https://dlcdn.apache.org/kafka/$KAFKA_VERSION/kafka_2.13-$KAFKA_VERSION.tgz"
22+
curl $CURL_OPTS -o "kafka_2.13-$KAFKA_VERSION.tgz" "https://dlcdn.apache.org/kafka/$KAFKA_VERSION/kafka_2.13-$KAFKA_VERSION.tgz"
2123
fi
2224
cp kafka_2.13-$KAFKA_VERSION.tgz build/kafka.tgz
2325
mkdir build/kafka && tar xzf build/kafka.tgz -C build/kafka --strip-components 1
@@ -40,7 +42,7 @@ if [ ! -e confluent-community-$CONFLUENT_VERSION.tar.gz ]; then
4042
echo "Confluent Platform not present locally, downloading"
4143
CONFLUENT_MINOR=$(echo "$CONFLUENT_VERSION" | sed -n 's/^\([[:digit:]]*\.[[:digit:]]*\)\.[[:digit:]]*$/\1/p')
4244
echo "CONFLUENT_MINOR is $CONFLUENT_MINOR"
43-
curl -s -o confluent-community-$CONFLUENT_VERSION.tar.gz http://packages.confluent.io/archive/$CONFLUENT_MINOR/confluent-community-$CONFLUENT_VERSION.tar.gz
45+
curl $CURL_OPTS -o confluent-community-$CONFLUENT_VERSION.tar.gz http://packages.confluent.io/archive/$CONFLUENT_MINOR/confluent-community-$CONFLUENT_VERSION.tar.gz
4446
fi
4547
cp confluent-community-$CONFLUENT_VERSION.tar.gz build/confluent_platform.tar.gz
4648
mkdir build/confluent_platform && tar xzf build/confluent_platform.tar.gz -C build/confluent_platform --strip-components 1
@@ -81,7 +83,7 @@ build/kafka/bin/kafka-topics.sh --create --partitions 1 --replication-factor 1 -
8183
build/kafka/bin/kafka-topics.sh --create --partitions 1 --replication-factor 1 --topic logstash_integration_zstd_topic --bootstrap-server localhost:9092
8284
build/kafka/bin/kafka-topics.sh --create --partitions 3 --replication-factor 1 --topic logstash_integration_partitioner_topic --bootstrap-server localhost:9092
8385
build/kafka/bin/kafka-topics.sh --create --partitions 3 --replication-factor 1 --topic logstash_integration_static_membership_topic --bootstrap-server localhost:9092
84-
curl -s -o build/apache_logs.txt https://s3.amazonaws.com/data.elasticsearch.org/apache_logs/apache_logs.txt
86+
curl $CURL_OPTS -o build/apache_logs.txt https://s3.amazonaws.com/data.elasticsearch.org/apache_logs/apache_logs.txt
8587
cat build/apache_logs.txt | build/kafka/bin/kafka-console-producer.sh --topic logstash_integration_topic_plain --broker-list localhost:9092
8688
cat build/apache_logs.txt | build/kafka/bin/kafka-console-producer.sh --topic logstash_integration_topic_snappy --broker-list localhost:9092 --compression-codec snappy
8789
cat build/apache_logs.txt | build/kafka/bin/kafka-console-producer.sh --topic logstash_integration_topic_lz4 --broker-list localhost:9092 --compression-codec lz4

0 commit comments

Comments
 (0)