Browse Source

Detect Docker initialization properly

Use netcat to check when the port opens, rather than an arbitrary
timeout. Hard limit of 60 seconds in case something breaks
remotes/origin/fix-delete-homeidr-on-userdelete
Robin McCorkell 10 years ago
committed by Thomas Müller
parent
commit
8467dbfa91
  1. 18
      apps/files_external/tests/env/start-amazons3-ceph.sh
  2. 19
      apps/files_external/tests/env/start-ftp-morrisjobke.sh
  3. 20
      apps/files_external/tests/env/start-sftp-atmoz.sh
  4. 19
      apps/files_external/tests/env/start-smb-silvershell.sh
  5. 18
      apps/files_external/tests/env/start-swift-ceph.sh
  6. 26
      apps/files_external/tests/env/start-webdav-ownCloud.sh

18
apps/files_external/tests/env/start-amazons3-ceph.sh

@ -49,9 +49,21 @@ echo "${docker_image} container: $container"
# put container IDs into a file to drop them after the test run (keep in mind that multiple tests run in parallel on the same host)
echo $container >> $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.amazons3
# TODO find a way to determine the successful initialization inside the docker container
echo "Waiting 20 seconds for ceph initialization ... "
sleep 20
echo -n "Waiting for ceph initialization"
starttime=$(date +%s)
# support for GNU netcat and BSD netcat
while ! (nc -c -w 1 ${host} ${port} </dev/null >&/dev/null \
|| nc -w 1 ${host} ${port} </dev/null >&/dev/null); do
sleep 1
echo -n '.'
if (( $(date +%s) > starttime + 60 )); then
echo
echo "[ERROR] Waited 60 seconds, no response" >&2
exit 1
fi
done
echo
sleep 1
echo "Create ceph user"
docker exec $container radosgw-admin user create \

19
apps/files_external/tests/env/start-ftp-morrisjobke.sh

@ -54,12 +54,25 @@ echo "ftp container: $container"
# put container IDs into a file to drop them after the test run (keep in mind that multiple tests run in parallel on the same host)
echo $container >> $thisFolder/dockerContainerMorrisJobke.$EXECUTOR_NUMBER.ftp
echo -n "Waiting for ftp initialization"
starttime=$(date +%s)
# support for GNU netcat and BSD netcat
while ! (nc -c -w 1 ${host} 21 </dev/null >&/dev/null \
|| nc -w 1 ${host} 21 </dev/null >&/dev/null); do
sleep 1
echo -n '.'
if (( $(date +%s) > starttime + 60 )); then
echo
echo "[ERROR] Waited 60 seconds, no response" >&2
exit 1
fi
done
echo
sleep 1
if [ -n "$DEBUG" ]; then
cat $thisFolder/config.ftp.php
cat $thisFolder/dockerContainerMorrisJobke.$EXECUTOR_NUMBER.ftp
fi
# TODO find a way to determine the successful initialization inside the docker container
echo "Waiting 5 seconds for ftp initialization ... "
sleep 5

20
apps/files_external/tests/env/start-sftp-atmoz.sh

@ -54,15 +54,27 @@ echo "sftp container: $container"
# put container IDs into a file to drop them after the test run (keep in mind that multiple tests run in parallel on the same host)
echo $container >> $thisFolder/dockerContainerAtmoz.$EXECUTOR_NUMBER.sftp
echo -n "Waiting for sftp initialization"
starttime=$(date +%s)
# support for GNU netcat and BSD netcat
while ! (nc -c -w 1 ${host} 22 </dev/null >&/dev/null \
|| nc -w 1 ${host} 22 </dev/null >&/dev/null); do
sleep 1
echo -n '.'
if (( $(date +%s) > starttime + 60 )); then
echo
echo "[ERROR] Waited 60 seconds, no response" >&2
exit 1
fi
done
echo
sleep 1
if [ -n "$DEBUG" ]; then
cat $thisFolder/config.sftp.php
cat $thisFolder/dockerContainerAtmoz.$EXECUTOR_NUMBER.sftp
fi
# TODO find a way to determine the successful initialization inside the docker container
echo "Waiting 5 seconds for sftp initialization ... "
sleep 5
# create folder "upload" with correct permissions
docker exec $container bash -c "mkdir /home/$user/upload && chown $user:users /home/$user/upload"

19
apps/files_external/tests/env/start-smb-silvershell.sh

@ -52,12 +52,25 @@ echo "samba container: $container"
# put container IDs into a file to drop them after the test run (keep in mind that multiple tests run in parallel on the same host)
echo $container >> $thisFolder/dockerContainerSilvershell.$EXECUTOR_NUMBER.smb
echo -n "Waiting for samba initialization"
starttime=$(date +%s)
# support for GNU netcat and BSD netcat
while ! (nc -c -w 1 ${host} 445 </dev/null >&/dev/null \
|| nc -w 1 ${host} 445 </dev/null >&/dev/null); do
sleep 1
echo -n '.'
if (( $(date +%s) > starttime + 60 )); then
echo
echo "[ERROR] Waited 60 seconds, no response" >&2
exit 1
fi
done
echo
sleep 1
if [ -n "$DEBUG" ]; then
cat $thisFolder/config.smb.php
cat $thisFolder/dockerContainerSilvershell.$EXECUTOR_NUMBER.smb
fi
# TODO find a way to determine the successful initialization inside the docker container
echo "Waiting 5 seconds for smbd initialization ... "
sleep 5

18
apps/files_external/tests/env/start-swift-ceph.sh

@ -56,9 +56,21 @@ echo "${docker_image} container: $container"
# put container IDs into a file to drop them after the test run (keep in mind that multiple tests run in parallel on the same host)
echo $container >> $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift
# TODO find a way to determine the successful initialization inside the docker container
echo "Waiting 20 seconds for ceph initialization ... "
sleep 20
echo -n "Waiting for ceph initialization"
starttime=$(date +%s)
# support for GNU netcat and BSD netcat
while ! (nc -c -w 1 ${host} 80 </dev/null >&/dev/null \
|| nc -w 1 ${host} 80 </dev/null >&/dev/null); do
sleep 1
echo -n '.'
if (( $(date +%s) > starttime + 60 )); then
echo
echo "[ERROR] Waited 60 seconds, no response" >&2
exit 1
fi
done
echo
sleep 1
cat > $thisFolder/config.swift.php <<DELIM
<?php

26
apps/files_external/tests/env/start-webdav-ownCloud.sh

@ -46,20 +46,30 @@ fi
container=`docker run -P $parameter -d -e ADMINLOGIN=test -e ADMINPWD=test morrisjobke/owncloud`
# TODO find a way to determine the successful initialization inside the docker container
echo "Waiting 30 seconds for ownCloud initialization ... "
sleep 30
# 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 :`
host=`docker inspect $container | grep IPAddress | cut -d '"' -f 4`
echo -n "Waiting for ownCloud initialization"
starttime=$(date +%s)
# support for GNU netcat and BSD netcat
while ! (nc -c -w 1 ${host} 80 </dev/null >&/dev/null \
|| nc -w 1 ${host} 80 </dev/null >&/dev/null); do
sleep 1
echo -n '.'
if (( $(date +%s) > starttime + 60 )); then
echo
echo "[ERROR] Waited 60 seconds, no response" >&2
exit 1
fi
done
echo
sleep 1
cat > $thisFolder/config.webdav.php <<DELIM
<?php
return array(
'run'=>true,
'host'=>'localhost:$port/owncloud/remote.php/webdav/',
'host'=>'${host}:80/owncloud/remote.php/webdav/',
'user'=>'test',
'password'=>'test',
'root'=>'',

Loading…
Cancel
Save