summaryrefslogtreecommitdiff
path: root/test/scripts/testutils.sh
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-01-30 11:16:29 +0100
committerLinus Nordberg <linus@nordu.net>2017-01-30 11:16:29 +0100
commitb4c6ed49b3e5482fb5bae01861f6293cdfc151ba (patch)
tree41f1527353128924bec01cb26279ed226a573f3e /test/scripts/testutils.sh
parent2e54755b9afacdb2d001b7ad4a81a8a23b6f43e0 (diff)
Add three functions to testutils.sh.
Diffstat (limited to 'test/scripts/testutils.sh')
-rw-r--r--test/scripts/testutils.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/test/scripts/testutils.sh b/test/scripts/testutils.sh
index 6879695..2aba2d1 100644
--- a/test/scripts/testutils.sh
+++ b/test/scripts/testutils.sh
@@ -9,12 +9,30 @@ assert_equal() {
test "$2" = "$3" || fail "$1 $2 != expected $3"
}
+wait_for_equal() {
+ n=$4
+ while [ $n -gt 0 ]; do
+ currentvalue="$(eval "$2")"
+ [ "${currentvalue}" = "$3" ] && return
+ echo "still ${currentvalue}, not $3"
+ 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/
+ get_treesize_host ${BASEURL}
+}
+get_treesize_host() {
+ ${top_srcdir}/tools/loginfo.py --config ${top_srcdir}/test/catlfish-test.cfg --localconfig ${top_srcdir}/test/catlfish-test-local-merge.cfg --treesize "$1"
}
check_sth() {
- ${top_srcdir}/tools/check-sth.py ${BASEURL} --publickey=keys/logkey.pem --cur-sth=stored-sth --cafile httpsca/demoCA/cacert.pem || fail "Check STH failed"
+ check_sth_host ${BASEURL}
+}
+check_sth_host() {
+ ${top_srcdir}/tools/check-sth.py "$1" --publickey=keys/logkey.pem --cur-sth=stored-sth --cafile httpsca/demoCA/cacert.pem || fail "Check STH failed"
}
do_merge() {