gnocchi/run-func-tests.sh
Mehdi Abaakouk aa0716be94 tests: functional with tox+pifpaf
Change-Id: I7d609a778c7c8592a3c7847e62b832d3805a71f4
2017-03-28 22:48:29 +02:00

56 lines
1.8 KiB
Bash
Executable File

#!/bin/bash -x
set -e
cleanup(){
type -t gnocchi_stop >/dev/null && gnocchi_stop || true
type -t indexer_stop >/dev/null && indexer_stop || true
type -t storage_stop >/dev/null && storage_stop || true
}
trap cleanup EXIT
GNOCCHI_TEST_STORAGE_DRIVERS=${GNOCCHI_TEST_STORAGE_DRIVERS:-file}
GNOCCHI_TEST_INDEXER_DRIVERS=${GNOCCHI_TEST_INDEXER_DRIVERS:-postgresql}
for storage in ${GNOCCHI_TEST_STORAGE_DRIVERS}; do
for indexer in ${GNOCCHI_TEST_INDEXER_DRIVERS}; do
case $storage in
ceph)
eval $(pifpaf -e STORAGE run ceph)
rados -c $STORAGE_CEPH_CONF mkpool gnocchi
STORAGE_URL=ceph://$STORAGE_CEPH_CONF
;;
s3)
if ! which s3rver >/dev/null 2>&1
then
mkdir -p npm-s3rver
export NPM_CONFIG_PREFIX=npm-s3rver
npm install s3rver --global
export PATH=$PWD/npm-s3rver/bin:$PATH
fi
eval $(pifpaf -e STORAGE run s3rver)
;;
file)
STORAGE_URL=file://
;;
swift|redis)
eval $(pifpaf -e STORAGE run $storage)
;;
*)
echo "Unsupported storage backend by functional tests: $storage"
exit 1
;;
esac
eval $(pifpaf -e INDEXER run $indexer)
eval $(pifpaf -e GNOCCHI run gnocchi --indexer-url $INDEXER_URL --storage-url $STORAGE_URL)
export GNOCCHI_SERVICE_URL=$GNOCCHI_ENDPOINT
export GNOCCHI_SERVICE_TOKEN="" # Just make gabbi happy
export GNOCCHI_AUTHORIZATION="basic YWRtaW46" # admin in base64
export OS_TEST_PATH=gnocchi/tests/functional_live
./tools/pretty_tox.sh $*
cleanup
done
done