Skip to content

Commit bd252ad

Browse files
committed
Use a local librdkafka installation different for every started test
Use test code from the checked out branch instead of the selected CKPy version Bootstrap the same way as when changing version: with `build.sh`
1 parent 217a24a commit bd252ad

File tree

3 files changed

+31
-32
lines changed

3 files changed

+31
-32
lines changed

tests/soak/bootstrap.sh

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ otel_collector_version=0.130.0
2020
otel_collector_package_url="https://github.com/open-telemetry/"\
2121
"opentelemetry-collector-releases/releases/download/"\
2222
"v${otel_collector_version}/otelcol-contrib_${otel_collector_version}_linux_amd64.deb"
23-
venv=$PWD/venv
23+
2424

2525
sudo apt update
2626
sudo apt install -y git curl wget make gcc g++ zlib1g-dev libssl-dev \
@@ -31,36 +31,12 @@ rm otel_collector_package.deb
3131
sudo cp otel-config.yaml /etc/otelcol-contrib/config.yaml
3232
sudo systemctl restart otelcol-contrib
3333

34-
if [[ ! -d confluent-kafka-python ]]; then
35-
git clone https://github.com/confluentinc/confluent-kafka-python
36-
fi
37-
38-
pushd confluent-kafka-python
39-
40-
git checkout $python_branch
41-
42-
echo "Installing librdkafka $librdkafka_branch"
43-
tools/bootstrap-librdkafka.sh --require-ssl $librdkafka_branch /usr
44-
rm -rf tmp-build
45-
46-
# echo "Installing interceptors"
47-
# tools/install-interceptors.sh
34+
./build.sh $librdkafka_branch $python_branch
4835

49-
echo "Setting up virtualenv in $venv"
50-
if [[ ! -d $venv ]]; then
51-
python3 -m venv $venv
52-
fi
36+
venv=$PWD/venv
5337
source $venv/bin/activate
54-
55-
pip install -U pip
56-
57-
pip install -v .[soaktest]
58-
59-
popd # ..python
60-
6138
echo "Verifying python client installation"
6239
python -c "import confluent_kafka; print(confluent_kafka.version(), confluent_kafka.libversion())"
63-
6440
deactivate
6541

6642
echo "All done, activate the virtualenv in $venv before running the client:"

tests/soak/build.sh

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,50 @@ fi
1111

1212
set -eu
1313

14+
testdir=$PWD
15+
mkdir -p $testdir/librdkafka-installation
1416

17+
if [[ ! -d confluent-kafka-python ]]; then
18+
git clone https://github.com/confluentinc/confluent-kafka-python
19+
fi
20+
21+
venv=$PWD/venv
22+
if [[ ! -d $venv ]]; then
23+
echo "Setting up virtualenv in $venv"
24+
python3 -m venv $venv
25+
source $venv/bin/activate
26+
pip install -U pip
27+
pip install -r $testdir/../../requirements/requirements-soaktest.txt
28+
deactivate
29+
fi
1530

1631
echo "Building and installing librdkafka $librdkafka_version"
1732
if [[ ! -d librdkafka ]]; then
1833
git clone https://github.com/confluentinc/librdkafka.git
1934
fi
2035
pushd librdkafka
21-
sudo make uninstall
2236
git fetch --tags
2337
git checkout $librdkafka_version
24-
./configure --reconfigure
38+
echo "Configuring librdkafka $librdkafka_version with prefix $testdir/librdkafka-installation"
39+
./configure --prefix=$testdir/librdkafka-installation
40+
sudo make uninstall
2541
make clean
2642
make -j
27-
sudo make install
43+
make install
2844
popd
2945

46+
export LIBRARY_PATH=$testdir/librdkafka-installation/lib
47+
export LD_LIBRARY_PATH=$testdir/librdkafka-installation/lib
48+
export CPLUS_INCLUDE_PATH=$testdir/librdkafka-installation/include
49+
export C_INCLUDE_PATH=$testdir/librdkafka-installation/include
3050

3151
echo "Building confluent-kafka-python $cflpy_version"
3252
set +u
3353
source venv/bin/activate
54+
python3 -m pip uninstall -y confluent-kafka
3455
set -u
3556
pushd confluent-kafka-python
57+
rm -rf ./build
3658
git fetch --tags
3759
git checkout $cflpy_version
3860
python3 -m pip install .
@@ -41,4 +63,3 @@ popd
4163
echo ""
4264
echo "=============================================================================="
4365
(cd / ; python3 -c 'import confluent_kafka as c; print("python", c.version(), "librdkafka", c.libversion())')
44-

tests/soak/run.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
source venv/bin/activate
44

5+
testdir=$PWD
6+
export LD_LIBRARY_PATH=$testdir/librdkafka-installation/lib
57
librdkafka_version=$(python3 -c 'from confluent_kafka import libversion; print(libversion()[0])')
68

79
if [[ -z $librdkafka_version ]]; then
@@ -17,7 +19,7 @@ echo "Starting soak client using topic $topic. Logging to $logfile."
1719
set +x
1820
# Ignore SIGINT in children (inherited)
1921
trap "" SIGINT
20-
time opentelemetry-instrument confluent-kafka-python/tests/soak/soakclient.py -i $TESTID -t $topic -r 80 -f $1 |& tee /dev/tty | bzip2 > $logfile &
22+
time opentelemetry-instrument $testdir/soakclient.py -i $TESTID -t $topic -r 80 -f $1 |& tee /dev/tty | bzip2 > $logfile &
2123
PID=$!
2224
# On SIGINT kill only the first process of the pipe
2325
onsigint() {

0 commit comments

Comments
 (0)