patroni/debian/tests/acceptance

41 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/bin/sh
set -e
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
2018-02-15 19:01:46 +01:00
export TZ=UTC # suppress UnknownTimeZoneError('Etc/UTC',)
DCS=etcd
if [ $(id -u) -eq 0 ]
then
2018-02-06 11:41:42 +01:00
# required so that the postgres user can create .coverage* and features/output/
chmod 777 .
chmod 777 features
SU='su postgres -p -c'
# zookeeper must be started manually (as root)
if ! [ -x /usr/bin/etcd ] && [ -x /etc/init.d/zookeeper ]; then
# JAVA_OPTS need to be set, otherwise zookeeper is not reachable via IPV4
sed -i -e 's/#JAVA_OPTS=""/JAVA_OPTS="-Djava.net.preferIPv4Stack=true"/' /etc/default/zookeeper
/etc/init.d/zookeeper start
DCS=zookeeper
fi
else
SU='bash -c'
fi
if [ -x /usr/bin/consul ]
then
DCS=consul
fi
2018-02-06 11:41:42 +01:00
# clean up afterwards
trap 'rm -f /tmp/pgpass?; if [ $(id -u) -eq 0 ] && [ -x /etc/init.d/zookeeper ]; then /etc/init.d/zookeeper stop; fi' 0 2 3 15
2018-02-06 11:41:42 +01:00
set -x
for PG_VERSION in /usr/lib/postgresql/*; do
$SU "ETCD_UNSUPPORTED_ARCH=386 DCS=$DCS PATH=/usr/lib/postgresql/$(basename ${PG_VERSION})/bin:$PATH behave" || \
(for file in $(ls features/output/*_failed/*); do echo "$file:"; cat $file; done && exit 1)
done