Fix webdav test env scripts to also work on CI
This commit is contained in:
parent
5d7f37d570
commit
d201ffe13d
|
@ -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'=>'',
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue