Skip to content

Commit

Permalink
update kafka testing to 3.6.0 (#3840)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmfitzpatrick authored Oct 30, 2023
1 parent f39dcac commit 758a2bf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func TestCollectdKafkaReceiversProvideAllMetrics(t *testing.T) {
"START_AS", "broker",
).WithExposedPorts("7099:7099", "9092:9092").WillWaitForPorts("7099", "9092"),

kafka.WithName("kafka-topic-creator").WithEnvVar(
"START_AS", "create-topic",
).WillWaitForLogs(`Created topic "sfx-employee".`),
kafka.WithName("kafka-topic-creator").WithEnv(map[string]string{
"START_AS": "create-topic", "KAFKA_BROKER": "kafka-broker:9092",
}).WillWaitForLogs(`Created topic sfx-employee.`),

kafka.WithName("kafka-producer").WithEnv(map[string]string{
"START_AS": "producer", "KAFKA_BROKER": "kafka-broker:9092", "JMX_PORT": "8099",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM bitnami/kafka:1.0.1-r2
FROM bitnami/kafka:3.6.0

ENV JMX_PORT=7099
EXPOSE 7099

ARG KAFKA_VERSION=1.0.1
ENV KAFKA_VERSION=$KAFKA_VERSION
ENV KAFKA_BIN="/opt/bitnami/kafka/bin"

ADD scripts/* scripts/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env bash
set -e

if [[ -z "$KAFKA_ZOOKEEPER_CONNECT" ]]; then
echo "ERROR: missing mandatory config: KAFKA_ZOOKEEPER_CONNECT"
if [[ -z "$KAFKA_BROKER" ]]; then
echo "ERROR: missing mandatory config: KAFKA_BROKER"
exit 1
fi
"$KAFKA_BIN"/kafka-topics.sh \
--create \
--zookeeper "$KAFKA_ZOOKEEPER_CONNECT" \
--bootstrap-server "$KAFKA_BROKER" \
--replication-factor 1 \
--partitions 1 \
--topic sfx-employee \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@ if [[ -z "$KAFKA_BROKER" ]]; then
exit 1
fi

if [ "$KAFKA_VERSION" = "2.0.0" ]; then
"$KAFKA_BIN"/kafka-console-consumer.sh \
--bootstrap-server "$KAFKA_BROKER" \
--topic sfx-employee \
--max-messages $((10 + RANDOM % 100))
else
"$KAFKA_BIN"/kafka-console-consumer.sh \
--bootstrap-server "$KAFKA_BROKER" \
--new-consumer \
--topic sfx-employee \
--max-messages $((10 + RANDOM % 100))
fi
"$KAFKA_BIN"/kafka-console-consumer.sh \
--bootstrap-server "$KAFKA_BROKER" \
--topic sfx-employee \
--max-messages $((10 + RANDOM % 100))

0 comments on commit 758a2bf

Please sign in to comment.