diff --git a/autotest.sh b/autotest.sh index 3f62657a90..be65ae165a 100755 --- a/autotest.sh +++ b/autotest.sh @@ -200,7 +200,7 @@ function execute_tests { fi mysql -u "$DATABASEUSER" -powncloud -e "DROP DATABASE IF EXISTS $DATABASENAME" -h $DATABASEHOST || true else - DATABASEHOST=127.0.0.1 + DATABASEHOST=mysql fi fi echo "Waiting for MySQL initialisation ..." @@ -254,6 +254,17 @@ function execute_tests { echo "Postgres is up." else + if [ ! -z "$DRONE" ] ; then + DATABASEHOST=postgres + fi + echo "Waiting for Postgres to be available ..." + if ! apps/files_external/tests/env/wait-for-connection $DATABASEHOST 5432 60; then + echo "[ERROR] Waited 60 seconds, no response" >&2 + exit 1 + fi + echo "Give it 10 additional seconds ..." + sleep 10 + if [ -z "$DRONE" ] ; then # no need to drop the DB when we are on CI dropdb -U "$DATABASEUSER" "$DATABASENAME" || true fi