summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-07-07 15:00:55 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-07-07 15:00:55 +0200
commit76b399d92393194095a109a9f7fcb3cf023b7638 (patch)
treeb8f4ecaa0efeaeca26fc965c2fb9dbab0d9d3997
parentd3e26a3127bcabde40fbf179651e414c709f1bc5 (diff)
parent5133a738e1e0246b5c5291268726a2afb21935e2 (diff)
downloadnextcloud-server-76b399d92393194095a109a9f7fcb3cf023b7638.tar.gz
nextcloud-server-76b399d92393194095a109a9f7fcb3cf023b7638.zip
Merge pull request #15579 from owncloud/autotest-docker-postgres
autotest.sh with docker support for postgres
-rwxr-xr-xautotest.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/autotest.sh b/autotest.sh
index 46c55edef19..4fa51e2d071 100755
--- a/autotest.sh
+++ b/autotest.sh
@@ -145,7 +145,20 @@ function execute_tests {
mysql -u "$DATABASEUSER" -powncloud -e "DROP DATABASE IF EXISTS $DATABASENAME" -h $DATABASEHOST || true
fi
if [ "$1" == "pgsql" ] ; then
- dropdb -U "$DATABASEUSER" "$DATABASENAME" || true
+ if [ ! -z "$USEDOCKER" ] ; then
+ echo "Fire up the postgres docker"
+ DOCKER_CONTAINER_ID=$(docker run -e POSTGRES_USER="$DATABASEUSER" -e POSTGRES_PASSWORD=owncloud -d postgres)
+ DATABASEHOST=$(docker inspect "$DOCKER_CONTAINER_ID" | grep IPAddress | cut -d '"' -f 4)
+
+ echo "Waiting for Postgres initialisation ..."
+
+ # grep exits on the first match and then the script continues
+ docker logs -f "$DOCKER_CONTAINER_ID" 2>&1 | grep -q "database system is ready to accept connections"
+
+ echo "Postgres is up."
+ else
+ dropdb -U "$DATABASEUSER" "$DATABASENAME" || true
+ fi
fi
if [ "$1" == "oci" ] ; then
echo "Fire up the oracle docker"
@@ -177,6 +190,12 @@ function execute_tests {
"${PHPUNIT[@]}" --configuration phpunit-autotest.xml --log-junit "autotest-results-$1.xml" "$2" "$3"
RESULT=$?
fi
+
+ if [ ! -z "$DOCKER_CONTAINER_ID" ] ; then
+ echo "Kill the docker $DOCKER_CONTAINER_ID"
+ docker rm -f $DOCKER_CONTAINER_ID
+ unset DOCKER_CONTAINER_ID
+ fi
}
#