deb-ceilometer/setup-test-env-elastic.sh
gordon chung cc7b8b4ecf add elasticsearch events db
this patch implements an elasticsearch driver for events.

Implements: blueprint elasticsearch-driver
Change-Id: Ie579f325685c14aed78d83de7c6d7bff326bc188
2015-02-03 22:58:07 -05:00

42 lines
988 B
Bash
Executable File

#!/bin/bash
set -e
source functions.sh
if [ "$1" = "--coverage" ]; then
COVERAGE_ARG="$1"
shift
fi
export PATH=$PATH:/usr/share/elasticsearch/bin
check_for_cmd elasticsearch
# check for Java
if [ -x "$JAVA_HOME/bin/java" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA=`which java`
fi
if [ ! -x "$JAVA" ]; then
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
exit 1
fi
# Start ElasticSearch process for tests
ES_DATA=`mktemp -d /tmp/CEILO-ES-XXXXX`
ES_PORT=9200
ES_PID=${ES_DATA}/elasticsearch.pid
elasticsearch -p ${ES_PID} -Des.http.port=${ES_PORT} -Des.path.logs=${ES_DATA}/logs -Des.path.data=${ES_DATA} -Des.path.conf=/etc/elasticsearch &> ${ES_DATA}/out &
# Wait for ElasticSearch to start listening to connections
sleep 3
wait_for_line "started" ${ES_DATA}/out
export CEILOMETER_TEST_ES_URL="es://localhost:${ES_PORT}"
# Yield execution to venv command
$*
# Kill ElasticSearch
kill $(cat ${ES_PID})