# #-- doh_downstream.test --# # source the master var file when it's there [ -f ../.tpkg.var.master ] && source ../.tpkg.var.master # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test PRE="../.." . ../common.sh get_make (cd $PRE; $MAKE dohclient) echo "> query www.example.net. endpoint /dns-query" $PRE/dohclient -s 127.0.0.1 -p $UNBOUND_PORT 1.example.net. A IN 2.example.net. A IN 3.example.net. A IN 4.example.net. A IN 5.example.net. A IN 6.example.net. A IN 7.example.net. A IN 8.example.net. A IN 9.example.net. A IN 10.example.net. A IN >outfile 2>&1 cat outfile if test "$?" -ne 0; then echo "exit status not OK" echo "> cat logfiles" cat outfile cat unbound.log echo "Not OK" exit 1 fi num=$(grep "ANSWER SEC" outfile | wc -l) # 58 byte answers, 500 byte max response buffer -> 8 answers # Sometimes unbound is scheduled to be able to respond very quickly, # before all the queries are sent, and then writes some of the queries # back already, emptying the buffer, which then does not overflow. # The attempt is to detect this test flakyness with 'mode w' write lines. nummodew=$(grep "mode w" unbound.log | wc -l) echo "num answers $num and num write events $nummodew" if [ $num -eq 8 ]; then echo "content OK" else if [ "(" $num -eq 9 -o $num -eq 10 ")" -a $nummodew -eq 2 ]; then echo "skip buffer emptied event" else echo "result contents not OK" echo "> cat logfiles" cat outfile cat unbound.log echo "result contents not OK" exit 1 fi fi echo "OK" exit 0