Check that reload with deleted journal works

This commit is contained in:
Mark Andrews
2021-07-22 09:55:01 +10:00
parent 163fb0b825
commit cf8aadfeb6
6 changed files with 138 additions and 0 deletions

View File

@@ -14,6 +14,14 @@
DIGOPTS="+tcp +dnssec -p ${PORT}"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
dig_with_opts() {
$DIG $DIGOPTS "$@"
}
rndccmd() {
$RNDCCMD "$@"
}
wait_for_serial() (
$DIG $DIGOPTS "@$1" "$2" SOA > "$4"
serial=$(awk '$4 == "SOA" { print $7 }' "$4")
@@ -1434,5 +1442,49 @@ grep "ixfr-from-differences: unchanged" nextpart.post$n.out && ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=$((n+1))
echo_i "Check that 'rndc reload' of just the serial updates the signed instance ($n)"
ret=0
dig_with_opts @10.53.0.8 example SOA > dig.out.ns8.test$n.soa1 || ret=1
cp ns8/example2.db.in ns8/example.db || ret=1
nextpart ns8/named.run > /dev/null
rndccmd 10.53.0.8 reload || ret=1
wait_for_log 3 "all zones loaded" ns8/named.run
sleep 1
dig_with_opts @10.53.0.8 example SOA > dig.out.ns8.test$n.soa2 || ret=1
soa1=$(awk '$4 == "SOA" { print $7 }' dig.out.ns8.test$n.soa1)
soa2=$(awk '$4 == "SOA" { print $7 }' dig.out.ns8.test$n.soa2)
ttl1=$(awk '$4 == "SOA" { print $2 }' dig.out.ns8.test$n.soa1)
ttl2=$(awk '$4 == "SOA" { print $2 }' dig.out.ns8.test$n.soa2)
test ${soa1:-1000} -lt ${soa2:-0} || ret=1
test ${ttl1:-0} -eq 300 || ret=1
test ${ttl2:-0} -eq 300 || ret=1
test "$ret" -eq 0 || echo_i "failed"
status=$((status+ret))
n=$((n+1))
echo_i "Check that restart with zone changes and deleted journal works ($n)"
TSIG=
ret=0
dig_with_opts @10.53.0.8 example SOA > dig.out.ns8.test$n.soa1 || ret=1
stop_server --use-rndc --port ${CONTROLPORT} inline ns8
# TTL of all records change from 300 to 400
cp ns8/example3.db.in ns8/example.db || ret=1
rm ns8/example.db.jnl
nextpart ns8/named.run > /dev/null
start_server --noclean --restart --port ${PORT} inline ns8
wait_for_log 3 "all zones loaded" ns8/named.run
sleep 1
dig_with_opts @10.53.0.8 example SOA > dig.out.ns8.test$n.soa2 || ret=1
soa1=$(awk '$4 == "SOA" { print $7 }' dig.out.ns8.test$n.soa1)
soa2=$(awk '$4 == "SOA" { print $7 }' dig.out.ns8.test$n.soa2)
ttl1=$(awk '$4 == "SOA" { print $2 }' dig.out.ns8.test$n.soa1)
ttl2=$(awk '$4 == "SOA" { print $2 }' dig.out.ns8.test$n.soa2)
test ${soa1:-1000} -lt ${soa2:-0} || ret=1
test ${ttl1:-0} -eq 300 || ret=1
test ${ttl2:-0} -eq 400 || ret=1
test "$ret" -eq 0 || echo_i "failed"
status=$((status+ret))
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1