]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix a timing issue in kasp system test
authorMatthijs Mekking <matthijs@isc.org>
Thu, 1 Oct 2020 09:07:05 +0000 (11:07 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Fri, 2 Oct 2020 07:20:40 +0000 (09:20 +0200)
Sometimes, not all keys have been created in time before 'check_keys'
is called. Run a 'retry_quiet' on checking the number of keys before
continuing checking the key data.

bin/tests/system/kasp/tests.sh

index 1851e341c065309755626fd075b70097f33a1c26..f9d20ee5c582f291efe57edc99253c717f3c644c 100644 (file)
@@ -832,23 +832,30 @@ status=$((status+ret))
 
 next_key_event_threshold=$((next_key_event_threshold+i))
 
+check_numkeys() {
+       _numkeys=$(get_keyids "$1" "$2" | wc -l)
+       test "$_numkeys" -eq "$NUM_KEYS" || return 1
+       return 0
+}
+
 # Check keys for a configured zone. This verifies:
 # 1. The right number of keys exist in the key pool ($1).
 # 2. The right number of keys is active. Checks KEY1, KEY2, KEY3, and KEY4.
 #
 # It is expected that KEY1, KEY2, KEY3, and KEY4 arrays are set correctly.
 # Found key identifiers are stored in the right key array.
-check_keys()
-{
+check_keys() {
        n=$((n+1))
        echo_i "check keys are created for zone ${ZONE} ($n)"
        ret=0
 
        echo_i "check number of keys for zone ${ZONE} in dir ${DIR} ($n)"
-       _numkeys=$(get_keyids "$DIR" "$ZONE" | wc -l)
-       test "$_numkeys" -eq "$NUM_KEYS" || log_error "bad number ($_numkeys) of key files for zone $ZONE (expected $NUM_KEYS)"
-       test "$ret" -eq 0 || echo_i "failed"
-       status=$((status+ret))
+       retry_quiet 10 check_numkeys "$DIR" "$ZONE" "$NUM_KEYS" || ret=1
+       if [ $ret -ne 0 ]; then
+               _numkeys=$(get_keyids "$1" "$2" | wc -l)
+               log_error "bad number of key files ($_numkeys) for zone $ZONE (expected $NUM_KEYS)"
+               status=$((status+ret))
+       fi
 
        # Temporarily don't log errors because we are searching multiple files.
        _log=0