diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-23 22:33:39 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-20 14:45:16 +0200 |
commit | 8467dbfa91921ccb0262161360edbf339f6b7daa (patch) | |
tree | 120855ef6ef2419794e35b7063eded324c99ec43 /apps/files_external/tests/env/start-swift-ceph.sh | |
parent | 70f4e9413fc4b7f676ecdb6b437751182a07dc56 (diff) | |
download | nextcloud-server-8467dbfa91921ccb0262161360edbf339f6b7daa.tar.gz nextcloud-server-8467dbfa91921ccb0262161360edbf339f6b7daa.zip |
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
Diffstat (limited to 'apps/files_external/tests/env/start-swift-ceph.sh')
-rwxr-xr-x | apps/files_external/tests/env/start-swift-ceph.sh | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/apps/files_external/tests/env/start-swift-ceph.sh b/apps/files_external/tests/env/start-swift-ceph.sh index c2e7d4c1ae1..a8305eee5a2 100755 --- a/apps/files_external/tests/env/start-swift-ceph.sh +++ b/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 |