summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/librdkafka-2.1.0/tests/lz4_manual_test.sh
blob: 7c604df736443ee4622ea9db3a188e092d402df0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
#

#
# Manual test (verification) of LZ4
# See README for details
#

set -e
# Debug what commands are being executed:
#set -x

TOPIC=lz4

if [[ $TEST_KAFKA_VERSION == "trunk" ]]; then
    RDK_ARGS="$RDK_ARGS -X api.version.request=true"
else
    if [[ $TEST_KAFKA_VERSION == 0.8.* ]]; then
	BROKERS=$(echo $BROKERS | sed -e 's/PLAINTEXT:\/\///g')
    fi
    RDK_ARGS="$RDK_ARGS -X broker.version.fallback=$TEST_KAFKA_VERSION"
fi

# Create topic
${KAFKA_PATH}/bin/kafka-topics.sh --zookeeper $ZK_ADDRESS --create \
	     --topic $TOPIC --partitions 1 --replication-factor 1

# Produce messages with rdkafka
echo "### Producing with librdkafka: ids 1000-1010"
seq 1000 1010 | ../examples/rdkafka_example -P -b $BROKERS -t $TOPIC \
					    -z lz4 $RDK_ARGS

# Produce with Kafka
echo "### Producing with Kafka: ids 2000-2010"
seq 2000 2010 | ${KAFKA_PATH}/bin/kafka-console-producer.sh \
			     --broker-list $BROKERS --compression-codec lz4 \
			     --topic $TOPIC

# Consume with rdkafka
echo "### Consuming with librdkafka: expect 1000-1010 and 2000-2010"
../examples/rdkafka_example -C -b $BROKERS -t $TOPIC -p 0 -o beginning -e -q -A \
			    $RDK_ARGS

# Consume with Kafka
echo "### Consuming with Kafka: expect 1000-1010 and 2000-2010"
if [[ $TEST_KAFKA_VERSION == "trunk" ]]; then
    ${KAFKA_PATH}/bin/kafka-console-consumer.sh -new-consumer \
		 --bootstrap-server $BROKERS --from-beginning --topic $TOPIC \
		 --timeout-ms 1000
else
    ${KAFKA_PATH}/bin/kafka-console-consumer.sh \
		 --zookeeper $ZK_ADDRESS --from-beginning --topic $TOPIC \
		 --max-messages 22
fi


echo ""
echo "### $TEST_KAFKA_VERSION: Did you see messages 1000-1010 and 2000-2010 from both consumers?"