Fix a timing issue in kasp system test
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.
(cherry picked from commit af3b014976)
This commit is contained in:
@@ -833,23 +833,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
|
||||
|
||||
Reference in New Issue
Block a user