From 925081b2d60ff8da7caf88b191385b01ccc6fbc4 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Mon, 12 Dec 2016 16:16:48 +0100 Subject: [PATCH] tox: use already installed kafka if present Change-Id: Ie1539035625693ec21a6ca279d59bb818343e618 --- setup-test-env-kafka.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/setup-test-env-kafka.sh b/setup-test-env-kafka.sh index ca981945b..3b385b7ce 100755 --- a/setup-test-env-kafka.sh +++ b/setup-test-env-kafka.sh @@ -3,14 +3,17 @@ set -e . tools/functions.sh -DATADIR=$(mktemp -d /tmp/OSLOMSG-KAFKA.XXXXX) -trap "clean_exit $DATADIR" EXIT +if [[ -z "$(which kafka-server-start)" ]] && [[ -z $(which kafka-server-start.sh) ]]; then + DATADIR=$(mktemp -d /tmp/OSLOMSG-KAFKA.XXXXX) + trap "clean_exit $DATADIR" EXIT -SCALA_VERSION="2.11" -KAFKA_VERSION="0.10.1.0" -tarball=kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz + SCALA_VERSION="2.11" + KAFKA_VERSION="0.10.1.0" + tarball=kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz + + wget http://apache.crihan.fr/dist/kafka/${KAFKA_VERSION}/$tarball -O $DATADIR/$tarball + tar -xzf $DATADIR/$tarball -C $DATADIR + export PATH=$DATADIR/kafka_${SCALA_VERSION}-${KAFKA_VERSION}/bin:$PATH +fi -wget http://apache.crihan.fr/dist/kafka/${KAFKA_VERSION}/$tarball -O $DATADIR/$tarball -tar -xzf $DATADIR/$tarball -C $DATADIR -export PATH=$DATADIR/kafka_${SCALA_VERSION}-${KAFKA_VERSION}/bin:$PATH pifpaf run kafka -- $*