panko/setup-test-env-es.sh
Ilya Tyaptin 57a9fc5bce Add running functional scripts for defined backend
This CR allows running "functional" tox job for different backends.
Short description about expected workflow:
1. Gate job run ceilometer/ceilometer/tests/functional/hooks/post_test_hook.py
with <backend> parameter.
2. This script run "tox -efunctional" command with defined variable
CEILOMETER_TEST_BACKEND
3. After in "run-functional-tests.sh" setup script for the backend
and testr are runned.

In this CR running testr with pretty_tox.sh script added because
it allows to use subunit-trace output which developed in tempest-lib
and improve useful of testr output.

Partially implements: blueprint ceilometer-functional-tests
Change-Id: Idb66aca0b46779516db2baec856df8223dbe5c13
2015-06-04 16:29:02 +03: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})