Commit af3b0149 authored by Matthijs Mekking's avatar Matthijs Mekking 🏡

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.
parent 7c555254
......@@ -832,23 +832,30 @@ status=$((status+ret))
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() {
echo_i "check keys are created for zone ${ZONE} ($n)"
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"
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)"
# Temporarily don't log errors because we are searching multiple files.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment