summaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/env
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-03 12:19:16 +0200
committerVincent Petry <pvince81@owncloud.com>2016-05-30 16:10:30 +0200
commitd201ffe13d74b326e0bf971674d2b162dc60baa0 (patch)
tree9333373f6186d2db7927d8c1af1d14fd8f1f21dd /apps/files_external/tests/env
parent5d7f37d57065715f09db2b61654044a027df4e91 (diff)
downloadnextcloud-server-d201ffe13d74b326e0bf971674d2b162dc60baa0.tar.gz
nextcloud-server-d201ffe13d74b326e0bf971674d2b162dc60baa0.zip
Fix webdav test env scripts to also work on CI
Diffstat (limited to 'apps/files_external/tests/env')
-rwxr-xr-xapps/files_external/tests/env/start-webdav-apache.sh30
-rwxr-xr-xapps/files_external/tests/env/stop-webdav-apache.sh1
2 files changed, 24 insertions, 7 deletions
diff --git a/apps/files_external/tests/env/start-webdav-apache.sh b/apps/files_external/tests/env/start-webdav-apache.sh
index 82014243190..48acb8572d6 100755
--- a/apps/files_external/tests/env/start-webdav-apache.sh
+++ b/apps/files_external/tests/env/start-webdav-apache.sh
@@ -13,6 +13,7 @@
#
# @author Morris Jobke
# @copyright 2014 Morris Jobke <hey@morrisjobke.de>
+# @copyright 2016 Vincent Petry <pvince81@owncloud.com>
#
if ! command -v docker >/dev/null 2>&1; then
@@ -32,21 +33,36 @@ if [ -z "$thisFolder" ]; then
thisFolder="."
fi;
-container=`docker run -d -e USERNAME=test -e PASSWORD=test -p 8888:80 morrisjobke/webdav`
+if [ -n "$RUN_DOCKER_MYSQL" ]; then
+ echo "Fetch recent mysql docker image"
+ docker pull mysql
-# TODO find a way to determine the successful initialization inside the docker container
-echo "Waiting 30 seconds for Webdav initialization ... "
-sleep 30
+ echo "Setup MySQL ..."
+ # user/password will be read by ENV variables in owncloud container (they are generated by docker)
+ databaseContainer=`docker run -e MYSQL_ROOT_PASSWORD=mysupersecretpassword -d mysql`
+ containerName=`docker inspect $databaseContainer | grep Name | grep _ | cut -d \" -f 4 | cut -d / -f 2`
-# get mapped port on host for internal port 80 - output is IP:PORT - we need to extract the port with 'cut'
-port=`docker port $container 80 | cut -f 2 -d :`
+ parameter="--link $containerName:db"
+fi
+
+container=`docker run -P $parameter -d -e USERNAME=test -e PASSWORD=test morrisjobke/webdav`
+host=`docker inspect --format="{{.NetworkSettings.IPAddress}}" $container`
+
+echo -n "Waiting for Apache initialization on ${host}:${port}"
+if ! "$thisFolder"/env/wait-for-connection ${host} 80 60; then
+ echo "[ERROR] Waited 60 seconds, no response" >&2
+ exit 1
+fi
+
+# wait at least 5 more seconds - sometimes the webserver still needs some additional time
+sleep 5
cat > $thisFolder/config.webdav.php <<DELIM
<?php
return array(
'run'=>true,
- 'host'=>'localhost:$port/webdav/',
+ 'host'=>'${host}:80/webdav/',
'user'=>'test',
'password'=>'test',
'root'=>'',
diff --git a/apps/files_external/tests/env/stop-webdav-apache.sh b/apps/files_external/tests/env/stop-webdav-apache.sh
index 9ebf96030aa..e898a65cc36 100755
--- a/apps/files_external/tests/env/stop-webdav-apache.sh
+++ b/apps/files_external/tests/env/stop-webdav-apache.sh
@@ -7,6 +7,7 @@
#
# @author Morris Jobke
# @copyright 2014 Morris Jobke <hey@morrisjobke.de>
+# @copyright 2016 Vincent Petry <pvince81@owncloud.com>
#
if ! command -v docker >/dev/null 2>&1; then