summaryrefslogtreecommitdiff
path: root/test/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'test/scripts')
-rwxr-xr-xtest/scripts/continuous-merge-test-run-1.sh18
-rw-r--r--test/scripts/testutils.sh10
2 files changed, 14 insertions, 14 deletions
diff --git a/test/scripts/continuous-merge-test-run-1.sh b/test/scripts/continuous-merge-test-run-1.sh
index 1a1dae6..92e8596 100755
--- a/test/scripts/continuous-merge-test-run-1.sh
+++ b/test/scripts/continuous-merge-test-run-1.sh
@@ -3,8 +3,6 @@
set -o nounset
set -o errexit
-SLEEP=40
-
top_srcdir=$(cd $(dirname $0)/../..; pwd)
. ${top_srcdir}/test/scripts/testutils.sh
@@ -17,12 +15,9 @@ for certfile in ${top_srcdir}/tools/testcerts/cert[1-5].txt ${top_srcdir}/tools/
python ${top_srcdir}/tools/submitcert.py --parallel=1 --store $certfile --check-sct --sct-file=submittedcerts ${BASEURL} --publickey=keys/logkey.pem --cafile httpsca/demoCA/cacert.pem || fail "Submission failed"
done
python ${top_srcdir}/tools/storagegc.py --config ${top_srcdir}/test/catlfish-test.cfg --localconfig ${top_srcdir}/test/catlfish-test-local-1.cfg || fail "GC failed"
-echo "$0: sleeping for $SLEEP seconds"
-sleep $SLEEP
+wait_for_equal "Tree size" "get_treesize" 7 15
check_sth
-assert_equal "Tree size" "$(get_treesize)" 7
-
mkdir fetchcertstore
python ${top_srcdir}/tools/fetchallcerts.py ${BASEURL} --store fetchcertstore --publickey=keys/logkey.pem --cafile httpsca/demoCA/cacert.pem || fail "Verification failed"
(cd fetchcertstore && unzip 0000.zip)
@@ -39,11 +34,9 @@ echo NOTE: merge backup should fail with 111 Connection refused
${top_srcdir}/tools/to_catlfish.py to_erl nodes/merge-2/ "init:stop()"
python ${top_srcdir}/tools/submitcert.py --parallel=1 --store ${top_srcdir}/tools/testcerts/cert6.txt --check-sct --sct-file=submittedcerts ${BASEURL} --publickey=keys/logkey.pem --cafile httpsca/demoCA/cacert.pem || fail "Submission failed"
-echo "$0: sleeping for $SLEEP seconds"
-sleep $SLEEP
-assert_equal "Tree size" "$(get_treesize)" 7
-
+wait_for_equal "Tree size" "get_treesize" 7 15
check_sth
+
../bin/run_erl -daemon nodes/merge-2/ nodes/merge-2/log/ "exec ../bin/erl -config merge-2"
for i in 1 2 3 4 5 6 7 8 9 10; do
echo "waiting for system to start" ; \
@@ -51,8 +44,5 @@ for i in 1 2 3 4 5 6 7 8 9 10; do
if curl -s --cacert httpsca/demoCA/cacert.pem -4 https://localhost:8181 > /dev/null ; then break; fi
done
-echo "$0: sleeping for $SLEEP seconds"
-sleep $SLEEP
-assert_equal "Tree size" "$(get_treesize)" 8
-
+wait_for_equal "Tree size" "get_treesize" 8 15
check_sth
diff --git a/test/scripts/testutils.sh b/test/scripts/testutils.sh
index d264464..faa7026 100644
--- a/test/scripts/testutils.sh
+++ b/test/scripts/testutils.sh
@@ -9,6 +9,16 @@ assert_equal() {
test "$2" = "$3" || fail "$1 $2 != expected $3"
}
+wait_for_equal() {
+ n=$4
+ while [ $n -gt 0 ]; do
+ [ $(eval "$2") = "$3" ] && return
+ n=$((n-1))
+ sleep 1
+ done
+ assert_equal "$1" "$(eval "$2")" "$3"
+}
+
get_treesize() {
${top_srcdir}/tools/loginfo.py --config ${top_srcdir}/test/catlfish-test.cfg --localconfig ${top_srcdir}/test/catlfish-test-local-merge.cfg --treesize https://localhost:8080/
}