1# #-- ctrl_pipe.test --# 2# source the master var file when it's there 3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 4# use .tpkg.var.test for in test variable passing 5[ -f .tpkg.var.test ] && source .tpkg.var.test 6 7PRE="../.." 8 9# exit value is 1 on usage 10$PRE/unbound-control -c ub.conf status 11if test $? -ne 0; then 12 echo "wrong exit value." 13 cat fwd.log 14 cat unbound.log 15 exit 1 16else 17 echo "exit value: OK" 18fi 19$PRE/unbound-control -c ub.conf local_data froob.example.net A 192.0.2.1 20if test $? -ne 0; then 21 echo "wrong exit value." 22 cat fwd.log 23 cat unbound.log 24 exit 1 25else 26 echo "exit value: OK" 27fi 28 29 30# test if the server is up. 31echo "> dig www.example.com." 32dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. | tee outfile 33echo "> check answer" 34if grep "10.20.30.40" outfile; then 35 echo "OK" 36else 37 echo "> cat logfiles" 38 cat fwd.log 39 cat unbound.log 40 echo "Not OK" 41 exit 1 42fi 43 44echo "> dig froob.example.net." 45dig @127.0.0.1 -p $UNBOUND_PORT froob.example.net. | tee outfile 46echo "> check answer" 47if grep "192.0.2.1" outfile; then 48 echo "OK" 49else 50 echo "> cat logfiles" 51 cat fwd.log 52 cat unbound.log 53 echo "Not OK" 54 exit 1 55fi 56 57echo "> cat logfiles" 58cat fwd.log 59cat unbound.log 60echo "> OK" 61exit 0 62