diff --git a/tests/config.yaml b/tests/config.yaml index 1cbd39a..556a512 100644 --- a/tests/config.yaml +++ b/tests/config.yaml @@ -43,11 +43,23 @@ test: done test "$up" -ne 0 testhost: - selfcheck: - - 'env PGPASSWORD=mtftest psql -h localhost -U mtftest -f test.sql | egrep "anything|something"' - #- 'echo errr | nc localhost 11211' - #- 'echo set AAA 0 4 2 | nc localhost 11211' - #- 'echo get AAA | nc localhost 11211' - #selcheckError: - #- 'echo errr | nc localhost 11211 |grep ERROR' - + db_usable: + - | + export PGPASSWORD=mtftest + PSQL="psql -h localhost -U mtftest -q" + up=0 + for i in `seq 20`; do + echo "Pinging PostgreSQL ($i)" + if $PSQL -c "" >&/dev/null; then + up=1 + break + else + sleep 1 + fi + done + if [ "$up" -eq 1 ]; then + $PSQL -f test.sql | egrep "anything|something" + else + echo "Unable to connect to database." >&2 + false + fi