use classpath kafka when running tests for versions other than 2.0.0
this ensures that the tests run against correct broker versions
@@ -130,19 +130,38 @@ stop_s3() {
}
start_zookeeper() {
+ if [[ "$MVN_PROFILE" == kafka-2.0.0 ]];then
run_command "docker-compose up -d zookeeper"
+ else
+ run_command "${BASE_DIR}/run_kafka_class.sh \
+ org.apache.zookeeper.server.quorum.QuorumPeerMain ${CONF_DIR}/zookeeper.test.properties > \
+ ${LOGS_DIR}/zookeeper.log 2>&1 &"
+ fi
}
stop_zookeeper() {
+ if [[ "$MVN_PROFILE" == kafka-2.0.0 ]];then
run_command "docker-compose rm -sf zookeeper"
+ else
+ run_command "pkill -f 'org.apache.zookeeper.server.quorum.QuorumPeerMain' || true"
+ fi
}
start_kafka_server () {
+ if [[ "$MVN_PROFILE" == kafka-2.0.0 ]];then
run_command "docker-compose up -d kafka"
+ else
+ run_command "${BASE_DIR}/run_kafka_class.sh kafka.Kafka ${CONF_DIR}/kafka.test.properties > \
+ ${LOGS_DIR}/kafka_server.log 2>&1 &"
+ fi
}
stop_kafka_server() {
+ if [[ "$MVN_PROFILE" == kafka-2.0.0 ]];then
run_command "docker-compose rm -sf kafka"
+ else
+ run_command "pkill -f 'kafka.Kafka' || true"
+ fi
}
start_secor() {
@@ -191,7 +210,13 @@ run_finalizer() {
}
create_topic() {
+ if [[ "$MVN_PROFILE" == kafka-2.0.0 ]];then
run_command "docker-compose exec kafka kafka-topics --zookeeper zookeeper:2181 --create --replication-factor 1 --partitions 2 --topic test"
+ else
+ run_command "${BASE_DIR}/run_kafka_class.sh kafka.admin.TopicCommand --create --zookeeper \
+ localhost:2181 --replication-factor 1 --partitions 2 --topic test > \
+ ${LOGS_DIR}/create_topic.log 2>&1"
+ fi
}
# post messages
