Skip to content

Commit

Permalink
[FLINK-10110][tests] Harden Kafka component shut down for E2E tests
Browse files Browse the repository at this point in the history
Instead of only calling kafka-server-stop.sh and zookeeper-server-stop.sh which can fail
due to KAFKA-4931 we also use jps to kill the Kafka and ZooKeeper processes.

This closes apache#6530.
  • Loading branch information
tillrohrmann committed Aug 15, 2018
1 parent 7af933b commit d8ae637
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions flink-end-to-end-tests/test-scripts/kafka-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ function start_kafka_cluster {
function stop_kafka_cluster {
$KAFKA_DIR/bin/kafka-server-stop.sh
$KAFKA_DIR/bin/zookeeper-server-stop.sh

PIDS=$(jps -vl | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}')

if [ ! -z "$PIDS" ]; then
kill -s TERM $PIDS
fi

PIDS=$(jps -vl | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}')

if [ ! -z "$PIDS" ]; then
kill -s TERM $PIDS
fi
}

function create_kafka_topic {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ function test_cleanup {
# don't call ourselves again for normal exit
trap "" EXIT

stop_kafka_cluster
stop_confluent_schema_registry
stop_kafka_cluster
}

trap test_cleanup INT
Expand Down

0 comments on commit d8ae637

Please sign in to comment.