patroni/debian/tests/acceptance
Michael Banck df088977ed * debian/patches/behave_failure_logging.patch: New patch, copy over output
directory of a failed feature with `_failed' at the end.
  * debian/tests/acceptance: Dump logs for failed features.
2018-09-25 15:44:49 +02:00

34 lines
954 B
Bash
Executable file

#!/bin/sh
set -e
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export TZ=UTC # suppress UnknownTimeZoneError('Etc/UTC',)
DCS=etcd
if [ $(id -u) -eq 0 ]
then
# 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
/etc/init.d/zookeeper start
DCS=zookeeper
fi
else
SU='bash -c'
fi
# 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
set -x
for PG_VERSION in /usr/lib/postgresql/*; do
$SU "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