Skip to content

Commit 38d0f03

Browse files
authored
Soak test helpers (#1484)
1 parent 16b7747 commit 38d0f03

File tree

4 files changed

+107
-1
lines changed

4 files changed

+107
-1
lines changed

tests/soak/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,22 @@ DataDog reporting supported by setting datadog.api_key a and datadog.app_key
1010
in the soak client configuration file.
1111

1212

13-
Use ubuntu-bootstrap.sh in this directory set up the environment (e.g., on ec2).
13+
There are some convenience script to get you started.
14+
15+
On the host (ec2) where you aim to run the soaktest, do:
16+
17+
$ git clone https://github.com/confluentinc/librdkafka
18+
$ git clone https://github.com/confluentinc/confluent-kafka-python
19+
20+
# Build librdkafka and python
21+
$ ~/confluent-kafka-python/tests/soak/build.sh <librdkafka-version> <cfl-python-version>
22+
23+
# Set up config:
24+
$ cp ~/confluent-kafka-python/tests/soak/ccloud.config.example ~/confluent-kafka-python/ccloud.config
25+
26+
# Start a screen session
27+
$ screen bash
28+
29+
# Within the screen session, run the soak client
30+
(screen)$ ~/run.sh
31+
(screen)$ Ctrl-A d # to detach

tests/soak/build.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
#
3+
4+
librdkafka_version=$1
5+
cflpy_version=$2
6+
7+
if [[ -z $cflpy_version ]]; then
8+
echo "Usage: $0 <librdkafka_version|tag|branch> <cfl-kafka-python-version|tag|branch>"
9+
exit 1
10+
fi
11+
12+
set -eu
13+
14+
15+
16+
echo "Building and installing librdkafka $librdkafka_version"
17+
pushd librdkafka
18+
sudo make uninstall
19+
git fetch --tags
20+
git checkout $librdkafka_version
21+
./configure --reconfigure
22+
make clean
23+
make -j
24+
sudo make install
25+
popd
26+
27+
28+
echo "Building confluent-kafka-python $cflpy_version"
29+
set +u
30+
source venv/bin/activate
31+
set -u
32+
pushd confluent-kafka-python
33+
git fetch --tags
34+
git checkout $cflpy_version
35+
python3 setup.py clean -a
36+
python3 setup.py build
37+
python3 -m pip install .
38+
popd
39+
40+
echo ""
41+
echo "=============================================================================="
42+
(cd / ; python3 -c 'import confluent_kafka as c; print("python", c.version(), "librdkafka", c.libversion())')
43+

tests/soak/ccloud.config.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
bootstrap.servers=<add your bootstraps here>
2+
sasl.mechanisms=PLAIN
3+
security.protocol=SASL_SSL
4+
sasl.username=<your ccloud access key>
5+
sasl.password=<your ccloud secret>
6+
enable.idempotence=true
7+
debug=eos,generic,broker,security,consumer
8+
linger.ms=2
9+
compression.type=lz4
10+
# DataDog options/config
11+
datadog.api_key=<datadog api key>
12+
datadog.app_key=<datadog app key>
13+
14+

tests/soak/run.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
#
3+
4+
set -e
5+
source venv/bin/activate
6+
7+
librdkafka_version=$(python3 -c 'from confluent_kafka import libversion; print(libversion()[0])')
8+
9+
if [[ -z $librdkafka_version ]]; then
10+
echo "No librdkafka version found.."
11+
exit 1
12+
fi
13+
14+
if [[ -z $STY ]]; then
15+
echo "This script should be run from inside a screen session"
16+
exit 1
17+
fi
18+
19+
set -u
20+
topic="pysoak-$librdkafka_version"
21+
logfile="${topic}.log.bz2"
22+
23+
echo "Starting soak client using topic $topic with logs written to $logfile"
24+
set +x
25+
time confluent-kafka-python/tests/soak/soakclient.py -t $topic -r 80 -f confluent-kafka-python/ccloud.config 2>&1 \
26+
| tee /dev/stderr | bzip2 > $logfile
27+
ret=$?
28+
echo "Python client exited with status $ret"
29+
exit $ret
30+
31+

0 commit comments

Comments
 (0)