mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-09-22 17:54:57 +02:00
- More predictable testing for cachedb.
This commit is contained in:
+14
-14
@@ -50,7 +50,7 @@ FILTERED_STATS_FILE=filtered_stats.$$
|
||||
FOUND_STATS_FILE=found_stats.$$
|
||||
REST_STATS_FILE=rest_stats.$$
|
||||
|
||||
DEBUG=1
|
||||
DEBUG=0
|
||||
|
||||
# Write stats to $STATS_FILE.
|
||||
# Call this when you want to get stats from unbound.
|
||||
@@ -95,7 +95,7 @@ check_expected_stats () {
|
||||
else
|
||||
echo "! bad expected stats:"
|
||||
cat $FILTERED_STATS_FILE
|
||||
exit 1
|
||||
end 1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ check_rest_stats () {
|
||||
fi
|
||||
if grep -v "=0$" $REST_STATS_FILE; then
|
||||
echo "! bad rest stats"
|
||||
exit 1
|
||||
end 1
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
@@ -426,9 +426,9 @@ wait_unbound_up unbound.log
|
||||
echo
|
||||
echo "[ Check cachedb cache miss. ]"
|
||||
echo "> dig www.example.com."
|
||||
dig @127.0.0.1 -p $UNBOUND_PORT 0ttl.example.com. | tee outfile
|
||||
dig @127.0.0.1 +ednsopt=65534 -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||
echo "> check answer"
|
||||
if grep "0.0.0.1" outfile; then
|
||||
if grep "10.20.30.40" outfile; then
|
||||
echo "OK"
|
||||
else
|
||||
end 1
|
||||
@@ -446,7 +446,7 @@ num.query.flags.AD=1
|
||||
num.query.edns.present=1
|
||||
num.query.udpout=1
|
||||
num.query.cachedb=0
|
||||
msg.cache.count=0
|
||||
msg.cache.count=1
|
||||
rrset.cache.count=1
|
||||
infra.cache.count=1
|
||||
num.answer.rcode.NOERROR=1"
|
||||
@@ -454,9 +454,9 @@ num.answer.rcode.NOERROR=1"
|
||||
echo
|
||||
echo "[ Check cachedb cache hit. ]"
|
||||
echo "> dig www.example.com."
|
||||
dig @127.0.0.1 -p $UNBOUND_PORT 0ttl.example.com. | tee outfile
|
||||
dig @127.0.0.1 +ednsopt=65534 -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||
echo "> check answer"
|
||||
if grep "0.0.0.1" outfile; then
|
||||
if grep "10.20.30.40" outfile; then
|
||||
echo "OK"
|
||||
else
|
||||
end 1
|
||||
@@ -482,25 +482,25 @@ num.answer.rcode.NOERROR=1"
|
||||
echo
|
||||
echo "[ Check cachedb cache hit with stat reset ]"
|
||||
echo "> dig www.example.com."
|
||||
dig @127.0.0.1 -p $UNBOUND_PORT 0ttl.example.com. | tee outfile
|
||||
dig @127.0.0.1 +ednsopt=65534 -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||
echo "> check answer"
|
||||
if grep "0.0.0.1" outfile; then
|
||||
if grep "10.20.30.40" outfile; then
|
||||
echo "OK"
|
||||
else
|
||||
end 1
|
||||
fi
|
||||
check_stats "\
|
||||
total.num.queries=1
|
||||
total.num.cachemiss=0
|
||||
total.num.cachehits=1
|
||||
total.num.recursivereplies=0
|
||||
total.num.cachemiss=1
|
||||
total.num.cachehits=0
|
||||
total.num.recursivereplies=1
|
||||
num.query.type.A=1
|
||||
num.query.class.IN=1
|
||||
num.query.opcode.QUERY=1
|
||||
num.query.flags.RD=1
|
||||
num.query.flags.AD=1
|
||||
num.query.edns.present=1
|
||||
num.query.cachedb=0
|
||||
num.query.cachedb=1
|
||||
msg.cache.count=1
|
||||
rrset.cache.count=1
|
||||
infra.cache.count=1
|
||||
|
||||
Reference in New Issue
Block a user