#!/usr/bin/env bash set -e if [ "${PDNS_DEBUG}" = "YES" ]; then set -x fi bindwait () { configname=$1 domcount=1 loopcount=0 while [ $loopcount -lt 20 ]; do sleep 1 done=$( ($PDNSCONTROL --config-name=$configname --socket-dir=. --no-config bind-domain-status || true) | grep -c 'parsed into memory' || true ) if [ $done = $domcount ] then return fi let loopcount=loopcount+1 done if [ $done != $domcount ]; then echo "Domain parsing failed" >> failed_tests fi } port=5501 rm -f pdns*.pid $PDNS --daemon=no --local-port=$port --socket-dir=./ \ --no-shuffle --launch=bind --bind-config=edns-packet-cache/named.conf \ --cache-ttl=60 --no-config --module-dir=../regression-tests/modules & bindwait # prime cache without EDNS $SDIG 127.0.0.1 5501 minimal.com SOA | LC_ALL=C sort # expect EDNS in identical query with EDNS SDIGBUFSIZE=512 $SDIG 127.0.0.1 5501 minimal.com SOA | LC_ALL=C sort # prime cache with EDNS SDIGBUFSIZE=512 $SDIG 127.0.0.1 5501 minimal.com NS | LC_ALL=C sort # expect no EDNS in identical query without EDNS $SDIG 127.0.0.1 5501 minimal.com NS | LC_ALL=C sort kill $(cat pdns*.pid) rm pdns*.pid