summaryrefslogtreecommitdiffstats
path: root/autotest.sh
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-05-06 19:36:44 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-05-06 19:36:44 +0200
commit59c4ea2c8da7a04b94a866c51375f874f1447a78 (patch)
tree0e35205d924ef4b7cade011d7f4cbe91fcc0dee9 /autotest.sh
parente2d8a4544db2e9210daa071840db3482b12fad9a (diff)
downloadnextcloud-server-59c4ea2c8da7a04b94a866c51375f874f1447a78.tar.gz
nextcloud-server-59c4ea2c8da7a04b94a866c51375f874f1447a78.zip
Use docker for mysql as well - optionally
Diffstat (limited to 'autotest.sh')
-rwxr-xr-xautotest.sh28
1 files changed, 27 insertions, 1 deletions
diff --git a/autotest.sh b/autotest.sh
index 6f966ac8852..bd51cddefcf 100755
--- a/autotest.sh
+++ b/autotest.sh
@@ -180,7 +180,33 @@ function execute_tests {
# drop database
if [ "$DB" == "mysql" ] ; then
- mysql -u "$DATABASEUSER" -powncloud -e "DROP DATABASE IF EXISTS $DATABASENAME" -h $DATABASEHOST || true
+ if [ ! -z "$USEDOCKER" ] ; then
+ echo "Fire up the mysql docker"
+ DOCKER_CONTAINER_ID=$(docker run \
+ -v $BASEDIR/tests/docker/mariadb:/etc/mysql/conf.d \
+ -e MYSQL_ROOT_PASSWORD=owncloud \
+ -e MYSQL_USER="$DATABASEUSER" \
+ -e MYSQL_PASSWORD=owncloud \
+ -e MYSQL_DATABASE="$DATABASENAME" \
+ -d mysql)
+ DATABASEHOST=$(docker inspect --format="{{.NetworkSettings.IPAddress}}" "$DOCKER_CONTAINER_ID")
+
+ echo "Waiting for MySQL initialisation ..."
+ if ! apps/files_external/tests/env/wait-for-connection $DATABASEHOST 3306 60; then
+ echo "[ERROR] Waited 60 seconds, no response" >&2
+ exit 1
+ fi
+
+ echo "MySQL is up."
+
+ else
+ if [ "mysql" != "$(mysql --version | grep -o mysql)" ] ; then
+ echo "Your mysql binary is not provided by mysql"
+ echo "To use the docker container set the USEDOCKER environment variable"
+ exit -1
+ fi
+ mysql -u "$DATABASEUSER" -powncloud -e "DROP DATABASE IF EXISTS $DATABASENAME" -h $DATABASEHOST || true
+ fi
fi
if [ "$DB" == "mariadb" ] ; then
if [ ! -z "$USEDOCKER" ] ; then