ceilometer/functions.sh
Ilya Tyaptin a744e1b9e7 Stop the tests if backend hasn't started
Now wait_for_line function behaves like all is ok even
if line hasn't been founded, but it should stop tests running.
In current CR checking of this situation is added.

Change-Id: I9f992feffd8d528e16d00269f62d24ce241f88ca
2015-07-15 21:22:00 +03:00

34 lines
737 B
Bash

function clean_exit(){
local error_code="$?"
if test -n "$CEILOMETER_TEST_HBASE_URL"
then
python tools/test_hbase_table_utils.py --clear
fi
rm -rf "$1"
kill $(jobs -p)
return $error_code
}
check_for_cmd () {
if ! which "$1" >/dev/null 2>&1
then
echo "Could not find $1 command" 1>&2
exit 1
fi
}
wait_for_line () {
exit_code=1
while read line
do
echo "$line" | grep -q "$1" && exit_code=0 && break
done < "$2"
# Read the fifo for ever otherwise process would block
cat "$2" >/dev/null &
if [ $exit_code -eq 1 ]; then
echo "Entries of \"$1\" have not been found. Now tests will be stopped."
exit $exit_code
fi
}