summaryrefslogtreecommitdiffstats
path: root/tests/objectstore
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-03-01 10:45:48 +0100
committerMorris Jobke <hey@morrisjobke.de>2016-03-01 10:45:48 +0100
commit4943a0326d5b49fba787f13842791b4161bd38e0 (patch)
tree263d7ef27da3be4abf1c33fb9ed73bd6d4e4c88d /tests/objectstore
parent078cc3b3f0ac34919b4b30cfa08799ce7743bc87 (diff)
downloadnextcloud-server-4943a0326d5b49fba787f13842791b4161bd38e0.tar.gz
nextcloud-server-4943a0326d5b49fba787f13842791b4161bd38e0.zip
Use sockets for startup notification in primary storage tests
Diffstat (limited to 'tests/objectstore')
-rwxr-xr-xtests/objectstore/start-swift-ceph.sh26
-rwxr-xr-xtests/objectstore/stop-swift-ceph.sh1
2 files changed, 13 insertions, 14 deletions
diff --git a/tests/objectstore/start-swift-ceph.sh b/tests/objectstore/start-swift-ceph.sh
index 8863a1f9f16..46cf51ad6cf 100755
--- a/tests/objectstore/start-swift-ceph.sh
+++ b/tests/objectstore/start-swift-ceph.sh
@@ -28,6 +28,10 @@ docker pull ${docker_image}
# retrieve current folder to place the config in the parent folder
thisFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+# create readiness notification socket
+notify_sock=$(readlink -f "$thisFolder"/dockerContainerCeph.$EXECUTOR_NUMBER.swift.sock)
+mkfifo "$notify_sock"
+
port=5034
user=test
@@ -45,6 +49,7 @@ container=`docker run -d \
-e KEYSTONE_SERVICE=${service} \
-e OSD_SIZE=300 \
-v ${thisFolder}/entrypoint.sh:/entrypoint.sh \
+ -v "$notify_sock":/run/notifyme.sock \
--privileged \
--entrypoint /entrypoint.sh ${docker_image}`
@@ -57,20 +62,13 @@ echo "${docker_image} container: $container"
echo $container >> $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift
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 + 160 )); then
- echo
- echo "[ERROR] Waited 120 seconds, no response" >&2
- exit 1
- fi
-done
-echo
-sleep 20 # the keystone server also needs some time to fully initialize
+ready=$(timeout 600 cat "$notify_sock")
+if [[ $ready != 'READY=1' ]]; then
+ echo "[ERROR] Waited 600 seconds, no response" >&2
+ docker logs $container
+ exit 1
+fi
+sleep 1
cat > $thisFolder/swift.config.php <<DELIM
<?php
diff --git a/tests/objectstore/stop-swift-ceph.sh b/tests/objectstore/stop-swift-ceph.sh
index 400db8925e9..23423e73d6a 100755
--- a/tests/objectstore/stop-swift-ceph.sh
+++ b/tests/objectstore/stop-swift-ceph.sh
@@ -38,3 +38,4 @@ fi;
# cleanup
rm -rf $thisFolder/swift.config.php
rm -rf $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift
+rm -rf $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift.sock