git » chasquid » commit 7e412db

test: Check debugging pages are not empty

author Alberto Bertogli
2020-08-19 22:57:24 UTC
committer Alberto Bertogli
2020-08-19 23:08:36 UTC
parent 607a455b2078d34c739e132458935bb79e700a34

test: Check debugging pages are not empty

When testing the debugging pages, do a quick check to verify that the
returned pages are not empty.

This covers the case where a template fails to execute at runtime, and
without this change it wouldn't be caught by tests.

test/t-09-loop/run.sh +16 -5

diff --git a/test/t-09-loop/run.sh b/test/t-09-loop/run.sh
index 7b6b1ec..c4f07d0 100755
--- a/test/t-09-loop/run.sh
+++ b/test/t-09-loop/run.sh
@@ -34,15 +34,26 @@ run_msmtp aliasB@srv-B < content
 
 # Get some of the debugging pages, for troubleshooting, and to make sure they
 # work reasonably well.
-wget -q -o /dev/null -O .data-A/dbg-root http://localhost:1099/ \
+function fetch() {
+	wget -q -o /dev/null -O $2 $1
+}
+
+function linesgt10() {
+	[ $( cat $1 | wc -l ) -gt 10 ]
+}
+
+fetch http://localhost:1099/ .data-A/dbg-root \
+	&& linesgt10 .data-A/dbg-root \
 	|| fail "failed to fetch /"
-wget -q -o /dev/null -O .data-A/dbg-flags http://localhost:1099/debug/flags \
+fetch http://localhost:1099/debug/flags .data-A/dbg-flags \
+	&& linesgt10 .data-A/dbg-flags \
 	|| fail "failed to fetch /debug/flags"
-wget -q -o /dev/null -O .data-A/dbg-queue http://localhost:1099/debug/queue \
+fetch http://localhost:1099/debug/queue .data-A/dbg-queue \
 	|| fail "failed to fetch /debug/queue"
-wget -q -o /dev/null -O .data-A/dbg-config http://localhost:1099/debug/config \
+fetch http://localhost:1099/debug/config .data-A/dbg-config \
+	&& linesgt10 .data-A/dbg-config \
 	|| fail "failed to fetch /debug/config"
-wget -q -o /dev/null -O .data-A/dbg-root http://localhost:1099/404 \
+fetch http://localhost:1099/404 .data-A/dbg-404 \
 	&& fail "fetch /404 worked, should have failed"
 
 # Wait until one of them has noticed and stopped the loop.