Test: stabilized test_restconf_internal* tests by looping

This commit is contained in:
Olof hagsand 2023-09-27 13:10:33 +02:00
parent 2d8567cd1b
commit 520f20def5
2 changed files with 64 additions and 48 deletions

View file

@ -96,7 +96,8 @@ function rpcstatus()
active=$1 active=$1
status=$2 status=$2
sleep $DEMSLEEP jmax=10
for j in $(seq 1 $jmax); do
new "send rpc status" new "send rpc status"
rpc=$(chunked_framing "<rpc $DEFAULTNS><process-control $LIBNS><name>restconf</name><operation>status</operation></process-control></rpc>") rpc=$(chunked_framing "<rpc $DEFAULTNS><process-control $LIBNS><name>restconf</name><operation>status</operation></process-control></rpc>")
retx=$($clixon_netconf -qef $cfg<<EOF retx=$($clixon_netconf -qef $cfg<<EOF
@ -123,6 +124,13 @@ EOF
match=$(echo "$retx" | grep --null -Go "$expect") match=$(echo "$retx" | grep --null -Go "$expect")
if [ -z "$match" ]; then if [ -z "$match" ]; then
echo "retry after sleep"
sleep $DEMSLEEP
continue
fi
break
done
if [ $j -eq $jmax ]; then
err "$expect" "$retx" err "$expect" "$retx"
fi fi
} }

View file

@ -111,13 +111,14 @@ function rpcstatus()
active=$1 active=$1
status=$2 status=$2
sleep $DEMSLEEP jmax=10
for j in $(seq 1 $jmax); do
new "send rpc status" new "send rpc status"
rpc=$(chunked_framing "<rpc $DEFAULTNS><process-control $LIBNS><name>restconf</name><operation>status</operation></process-control></rpc>") rpc=$(chunked_framing "<rpc $DEFAULTNS><process-control $LIBNS><name>restconf</name><operation>status</operation></process-control></rpc>")
retx=$($clixon_netconf -qef $cfg<<EOF retx=$($clixon_netconf -qef $cfg<<EOF
$DEFAULTHELLO$rpc $DEFAULTHELLO$rpc
EOF EOF
) )
# Check pid # Check pid
expect="<pid $LIBNS>[0-9]*</pid>" expect="<pid $LIBNS>[0-9]*</pid>"
match=$(echo "$retx" | grep --null -Go "$expect") match=$(echo "$retx" | grep --null -Go "$expect")
@ -139,6 +140,13 @@ EOF
fi fi
match=$(echo "$retx" | grep --null -Go "$expect") match=$(echo "$retx" | grep --null -Go "$expect")
if [ -z "$match" ]; then if [ -z "$match" ]; then
echo "retry after sleep"
sleep $DEMSLEEP
continue
fi
break
done
if [ $j -eq $jmax ]; then
err "$expect" "$retx" err "$expect" "$retx"
fi fi
} }