more attempts

This commit is contained in:
psklenar@redhat.com 2025-02-24 16:12:38 +01:00
commit 0876fb8523

View file

@ -237,22 +237,42 @@ rlJournalStart
rndc -h 2>&1 | grep -q 'managed-keys status' && HAS_MANAGED_KEYS='y'
rlPhaseEnd
for I in {1..3}; do
for I in {1..30}; do
rlPhaseStartTest "Basic test #$I"
rlRun "rlServiceStart named"
sleep 5 # this test works randomly
buDigSuccessSecure @localhost . DNSKEY
buDigSuccessSecure @localhost
KEYID=$(buDigKskId @localhost .)
rlAssertNotEquals "Check keyId is not empty." "$KEYID" ""
rlAssertGreater "Check $KEYID is non-zero" "$KEYID" 0
rlLog "`echo dig_cmd1;dig +nocrypto +short -t dnskey @localhost .| tail -n1 | awk '$1 == 257 { sub("]", "", $7); print $7 }'`"
rlLog "echo dig_cmd2;dig +nocrypto +short -t dnskey @localhost ."
TEST1=$(dig +multi $KEYID DNSKEY)
#KEYID=$(buDigKskId @localhost .)
#rlAssertGreater "Check $KEYID is non-zero" "$KEYID" 0
#rlAssertNotEquals "Check keyId is not empty." "$KEYID" ""
################
EMPTY_COUNT=0
KEYID=""
for i in {1..5}; do
KEYID=$(buDigKskId @localhost .)
if [[ -z "$KEYID" ]]; then
((EMPTY_COUNT++))
rlLog "Attempt $i: Empty result ($EMPTY_COUNT empty so far)"
else
rlLog "Attempt $i: Got KEYID = $KEYID"
LAST_WORKING_KEYID=$KEYID
fi
sleep 0.2
done
# If more than 3 failures, exit with error
rlAssertLesserOrEqual "Check EMPTY_COUNT is non-zero LESS than 15" "$EMPTY_COUNT" 15
################
TEST1=$(dig +multi $LAST_WORKING_KEYID DNSKEY)
rlLog "`echo dig_for_dnskey;echo $TEST1`"
rlRun "rndc secroots"
rlRun "grep \"^./RSASHA256/$KEYID\" /var/named/data/named.secroots" 0 "Check trust anchor is trusted"
rlRun "grep \"^./RSASHA256/$LAST_WORKING_KEYID\" /var/named/data/named.secroots" 0 "Check trust anchor is trusted"
[ "$HAS_MANAGED_KEYS" = y ] && rlRun "rndc managed-keys status"
rlPhaseEnd
done