1 # #-- cachedb_no_store.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
13 # query for a text record that is stored by unbound's cache and cachedb
14 # in the testframe cache.
15 echo "> dig txt1.example.com."
16 dig @localhost -p $UNBOUND_PORT txt1.example.com. TXT | tee outfile
17 if grep "example text message" outfile; then
24 # stop the forwarder with servfail, to check the answer came from the cache
25 echo "> stop ldns-testns"
27 echo "> start ldns-testns with servfails"
28 $LDNS_TESTNS -p $FWD_PORT cachedb_no_store.servfail.testns >fwd2.log 2>&1 &
30 echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
31 wait_ldns_testns_up fwd2.log
33 echo "> dig txt1.example.com. from unbound cache"
34 dig @localhost -p $UNBOUND_PORT txt1.example.com. TXT | tee outfile
35 if grep "example text message" outfile; then
42 # clear the cache of unbound, but not cachedb testframe cache
43 echo "> unbound-control flush"
44 $PRE/unbound-control -c ub.conf flush_type txt1.example.com. TXT
45 if test $? -ne 0; then
46 echo "wrong exit value."
52 echo "> dig txt1.example.com. from cachedb"
53 dig @localhost -p $UNBOUND_PORT txt1.example.com. TXT | tee outfile
54 if grep "example text message" outfile; then
61 # start the forwarder again.
62 echo "> stop ldns-testns"
64 echo "> start ldns-testns"
65 $LDNS_TESTNS -p $FWD_PORT cachedb_no_store.testns >fwd3.log 2>&1 &
67 echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
68 wait_ldns_testns_up fwd3.log
70 # stop unbound to flush the cachedb cache
72 kill_pid `cat unbound.pid`
75 echo "> config unbound with cachedb-no-store: yes"
76 echo "cachedb: cachedb-no-store: yes" >> ub.conf
78 # start unbound again.
79 echo "> start unbound"
80 $PRE/unbound -d -c ub.conf >unbound2.log 2>&1 &
82 echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
83 wait_unbound_up unbound2.log
86 echo "> dig txt1.example.com."
87 dig @localhost -p $UNBOUND_PORT txt1.example.com. TXT | tee outfile
88 if grep "example text message" outfile; then
95 # stop the forwarder with servfail, to check the answer came from the cache
96 echo "> stop ldns-testns"
98 echo "> start ldns-testns with servfails"
99 $LDNS_TESTNS -p $FWD_PORT cachedb_no_store.servfail.testns >fwd4.log 2>&1 &
101 echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
102 wait_ldns_testns_up fwd4.log
104 echo "> dig txt1.example.com. from unbound cache"
105 dig @localhost -p $UNBOUND_PORT txt1.example.com. TXT | tee outfile
106 if grep "example text message" outfile; then
113 # clear the cache of unbound, but not cachedb testframe cache
114 echo "> unbound-control flush"
115 $PRE/unbound-control -c ub.conf flush_type txt1.example.com. TXT
116 if test $? -ne 0; then
117 echo "wrong exit value."
120 echo "exit value: OK"
123 echo "> dig txt1.example.com. from cachedb, but that has no message stored"
124 dig @localhost -p $UNBOUND_PORT txt1.example.com. TXT | tee outfile
125 if grep "SERVFAIL" outfile; then