kasp tests: Replace while loops with retry_quiet

This commit is contained in:
Matthijs Mekking
2020-05-26 09:14:15 +02:00
parent e8e7effc19
commit cf76d839ae

View File

@@ -800,37 +800,32 @@ status=$((status+ret))
# #
# named # named
# #
#
# The NSEC record at the apex of the zone and its RRSIG records are # The NSEC record at the apex of the zone and its RRSIG records are
# added as part of the last step in signing a zone. We wait for the # added as part of the last step in signing a zone. We wait for the
# NSEC records to appear before proceeding with a counter to prevent # NSEC records to appear before proceeding with a counter to prevent
# infinite loops if there is a error. # infinite loops if there is an error.
#
n=$((n+1)) n=$((n+1))
echo_i "waiting for kasp signing changes to take effect ($n)" echo_i "waiting for kasp signing changes to take effect ($n)"
i=0
while [ $i -lt 30 ] _wait_for_done_apexnsec() {
do
ret=0
while read -r zone while read -r zone
do do
dig_with_opts "$zone" @10.53.0.3 nsec > "dig.out.ns3.test$n.$zone" || ret=1 dig_with_opts "$zone" @10.53.0.3 nsec > "dig.out.ns3.test$n.$zone" || return 1
grep "NS SOA" "dig.out.ns3.test$n.$zone" > /dev/null || ret=1 grep "NS SOA" "dig.out.ns3.test$n.$zone" > /dev/null || return 1
grep "$zone\..*IN.*RRSIG" "dig.out.ns3.test$n.$zone" > /dev/null || ret=1 grep "$zone\..*IN.*RRSIG" "dig.out.ns3.test$n.$zone" > /dev/null || return 1
done < ns3/zones done < ns3/zones
while read -r zone while read -r zone
do do
dig_with_opts "$zone" @10.53.0.6 nsec > "dig.out.ns6.test$n.$zone" || ret=1 dig_with_opts "$zone" @10.53.0.6 nsec > "dig.out.ns6.test$n.$zone" || return 1
grep "NS SOA" "dig.out.ns6.test$n.$zone" > /dev/null || ret=1 grep "NS SOA" "dig.out.ns6.test$n.$zone" > /dev/null || return 1
grep "$zone\..*IN.*RRSIG" "dig.out.ns6.test$n.$zone" > /dev/null || ret=1 grep "$zone\..*IN.*RRSIG" "dig.out.ns6.test$n.$zone" > /dev/null || return 1
done < ns6/zones done < ns6/zones
i=$((i+1)) return 0
if [ $ret = 0 ]; then break; fi }
echo_i "waiting ... ($i)" retry_quiet 30 _wait_for_done_apexnsec || ret=1
sleep 1
done
test "$ret" -eq 0 || echo_i "failed" test "$ret" -eq 0 || echo_i "failed"
status=$((status+ret)) status=$((status+ret))
@@ -1605,29 +1600,22 @@ echo_i "check that we correctly sign the zone after IXFR for zone ${ZONE} ($n)"
ret=0 ret=0
cp ns2/secondary.kasp.db.in2 ns2/secondary.kasp.db cp ns2/secondary.kasp.db.in2 ns2/secondary.kasp.db
rndccmd 10.53.0.2 reload "$ZONE" > /dev/null || log_error "rndc reload zone ${ZONE} failed" rndccmd 10.53.0.2 reload "$ZONE" > /dev/null || log_error "rndc reload zone ${ZONE} failed"
_log=0
i=0 _wait_for_done_subdomains() {
while [ $i -lt 5 ]
do
ret=0 ret=0
dig_with_opts "a.${ZONE}" "@${SERVER}" A > "dig.out.$DIR.test$n.a" || return 1
dig_with_opts "a.${ZONE}" "@${SERVER}" A > "dig.out.$DIR.test$n.a" || log_error "dig a.${ZONE} A failed" grep "status: NOERROR" "dig.out.$DIR.test$n.a" > /dev/null || return 1
grep "status: NOERROR" "dig.out.$DIR.test$n.a" > /dev/null || log_error "mismatch status in DNS response" grep "a.${ZONE}\..*${DEFAULT_TTL}.*IN.*A.*10\.0\.0\.11" "dig.out.$DIR.test$n.a" > /dev/null || return 1
grep "a.${ZONE}\..*${DEFAULT_TTL}.*IN.*A.*10\.0\.0\.11" "dig.out.$DIR.test$n.a" > /dev/null || log_error "missing a.${ZONE} A record in response"
check_signatures $_qtype "dig.out.$DIR.test$n.a" "ZSK" check_signatures $_qtype "dig.out.$DIR.test$n.a" "ZSK"
if [ $ret -gt 0 ]; then return $ret; fi
dig_with_opts "d.${ZONE}" "@${SERVER}" A > "dig.out.$DIR.test$n.d" || log_error "dig d.${ZONE} A failed" dig_with_opts "d.${ZONE}" "@${SERVER}" A > "dig.out.$DIR.test$n.d" || return 1
grep "status: NOERROR" "dig.out.$DIR.test$n.d" > /dev/null || log_error "mismatch status in DNS response" grep "status: NOERROR" "dig.out.$DIR.test$n.d" > /dev/null || return 1
grep "d.${ZONE}\..*${DEFAULT_TTL}.*IN.*A.*10\.0\.0\.4" "dig.out.$DIR.test$n.d" > /dev/null || log_error "missing d.${ZONE} A record in response" grep "d.${ZONE}\..*${DEFAULT_TTL}.*IN.*A.*10\.0\.0\.4" "dig.out.$DIR.test$n.d" > /dev/null || return 1
lines=$(get_keys_which_signed A "dig.out.$DIR.test$n.d" | wc -l)
check_signatures $_qtype "dig.out.$DIR.test$n.d" "ZSK" check_signatures $_qtype "dig.out.$DIR.test$n.d" "ZSK"
return $ret
i=$((i+1)) }
if [ $ret = 0 ]; then break; fi retry_quiet 5 _wait_for_done_subdomains || ret=1
echo_i "waiting ... ($i)"
sleep 1
done
_log=1
test "$ret" -eq 0 || echo_i "failed" test "$ret" -eq 0 || echo_i "failed"
status=$((status+ret)) status=$((status+ret))
@@ -3756,29 +3744,20 @@ now="$(TZ=UTC date +%s)"
time_passed=$((now-start_time)) time_passed=$((now-start_time))
echo_i "${time_passed} seconds passed between start of tests and reconfig" echo_i "${time_passed} seconds passed between start of tests and reconfig"
# The NSEC record at the apex of the zone and its RRSIG records are # The NSEC record at the apex of the zone and its RRSIG records are
# added as part of the last step in signing a zone. We wait for the # added as part of the last step in signing a zone. We wait for the
# NSEC records to appear before proceeding with a counter to prevent # NSEC records to appear before proceeding with a counter to prevent
# infinite loops if there is a error. # infinite loops if there is a error. Make sure the zone is signed
# # with the new algorithm.
n=$((n+1)) _wait_for_done_reconfig() {
echo_i "waiting for reconfig signing changes to take effect ($n)"
i=0
while [ $i -lt 30 ]
do
ret=0
while read -r zone while read -r zone
do do
dig_with_opts "$zone" @10.53.0.6 nsec > "dig.out.ns6.test$n.$zone" || ret=1 dig_with_opts "$zone" @10.53.0.6 nsec > "dig.out.ns6.test$n.$zone" || return 1
grep "NS SOA" "dig.out.ns6.test$n.$zone" > /dev/null || ret=1 grep "NS SOA" "dig.out.ns6.test$n.$zone" > /dev/null || return 1
grep "$zone\..*IN.*RRSIG" "dig.out.ns6.test$n.$zone" > /dev/null || ret=1 grep "$zone\..*IN.*RRSIG.*NSEC" "dig.out.ns6.test$n.$zone" > /dev/null || return 1
done < ns6/zones.2 done < ns6/zones.2
}
i=$((i+1)) retry_quiet 30 _wait_for_done_reconfig || ret=1
if [ $ret = 0 ]; then break; fi
echo_i "waiting ... ($i)"
sleep 1
done
test "$ret" -eq 0 || echo_i "failed" test "$ret" -eq 0 || echo_i "failed"
status=$((status+ret)) status=$((status+ret))