forked from gnocchixyz/gnocchi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-func-tests.sh
executable file
·72 lines (63 loc) · 2.29 KB
/
run-func-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash -x
set -e
cleanup(){
type -t indexer_stop >/dev/null && indexer_stop || true
type -t storage_stop >/dev/null && storage_stop || true
}
trap cleanup EXIT
check_empty_var() {
local x=$(eval echo `echo \\$${1}`)
if [ -z "$x" ]; then
echo "Variable \$${1} is unset"
exit 15
fi
}
PYTHON_VERSION_MAJOR=$(python -c 'import sys; print(sys.version_info.major)')
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
if [ "$storage" == "swift" ] && [ "$PYTHON_VERSION_MAJOR" == "3" ]; then
echo "WARNING: swift does not support python 3 skipping"
continue
fi
for indexer in ${GNOCCHI_TEST_INDEXER_DRIVERS}; do
unset STORAGE_URL
unset INDEXER_URL
case $storage in
ceph)
eval $(pifpaf -e STORAGE run ceph)
check_empty_var STORAGE_URL
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
check_empty_var STORAGE_URL
eval $(pifpaf -e INDEXER run $indexer)
check_empty_var INDEXER_URL
export GNOCCHI_SERVICE_TOKEN="" # Just make gabbi happy
export GNOCCHI_AUTHORIZATION="basic YWRtaW46" # admin in base64
export GNOCCHI_TEST_PATH=gnocchi/tests/functional_live
pifpaf -e GNOCCHI run gnocchi --indexer-url $INDEXER_URL --storage-url $STORAGE_URL --coordination-driver redis -- ./tools/pretty_tox.sh $*
cleanup
done
done