Test: stabilized test_restconf_internal* tests by looping
This commit is contained in:
parent
2d8567cd1b
commit
520f20def5
2 changed files with 64 additions and 48 deletions
|
|
@ -96,33 +96,41 @@ function rpcstatus()
|
||||||
active=$1
|
active=$1
|
||||||
status=$2
|
status=$2
|
||||||
|
|
||||||
sleep $DEMSLEEP
|
jmax=10
|
||||||
new "send rpc status"
|
for j in $(seq 1 $jmax); do
|
||||||
rpc=$(chunked_framing "<rpc $DEFAULTNS><process-control $LIBNS><name>restconf</name><operation>status</operation></process-control></rpc>")
|
new "send rpc status"
|
||||||
retx=$($clixon_netconf -qef $cfg<<EOF
|
rpc=$(chunked_framing "<rpc $DEFAULTNS><process-control $LIBNS><name>restconf</name><operation>status</operation></process-control></rpc>")
|
||||||
|
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")
|
||||||
if [ -z "$match" ]; then
|
if [ -z "$match" ]; then
|
||||||
pid=0
|
pid=0
|
||||||
else
|
else
|
||||||
pid=$(echo "$match" | awk -F'[<>]' '{print $3}')
|
pid=$(echo "$match" | awk -F'[<>]' '{print $3}')
|
||||||
fi
|
fi
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "No pid return value" "$retx"
|
err "No pid return value" "$retx"
|
||||||
fi
|
fi
|
||||||
if $active; then
|
if $active; then
|
||||||
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status><starttime $LIBNS>20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]*Z</starttime><pid $LIBNS>$pid</pid></rpc-reply>$"
|
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status><starttime $LIBNS>20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]*Z</starttime><pid $LIBNS>$pid</pid></rpc-reply>$"
|
||||||
else
|
else
|
||||||
# inactive, no startime or pid
|
# inactive, no startime or pid
|
||||||
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status></rpc-reply>$"
|
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status></rpc-reply>$"
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,34 +111,42 @@ function rpcstatus()
|
||||||
active=$1
|
active=$1
|
||||||
status=$2
|
status=$2
|
||||||
|
|
||||||
sleep $DEMSLEEP
|
jmax=10
|
||||||
new "send rpc status"
|
for j in $(seq 1 $jmax); do
|
||||||
rpc=$(chunked_framing "<rpc $DEFAULTNS><process-control $LIBNS><name>restconf</name><operation>status</operation></process-control></rpc>")
|
new "send rpc status"
|
||||||
retx=$($clixon_netconf -qef $cfg<<EOF
|
rpc=$(chunked_framing "<rpc $DEFAULTNS><process-control $LIBNS><name>restconf</name><operation>status</operation></process-control></rpc>")
|
||||||
|
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")
|
||||||
if [ -z "$match" ]; then
|
if [ -z "$match" ]; then
|
||||||
pid=0
|
pid=0
|
||||||
else
|
else
|
||||||
pid=$(echo "$match" | awk -F'[<>]' '{print $3}')
|
pid=$(echo "$match" | awk -F'[<>]' '{print $3}')
|
||||||
fi
|
fi
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "No pid return value" "$retx"
|
err "No pid return value" "$retx"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $active; then
|
if $active; then
|
||||||
# \- causes problems on some(alpine)
|
# \- causes problems on some(alpine)
|
||||||
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status><starttime $LIBNS>20[0-9][0-9].[0-9][0-9].[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]*Z</starttime><pid $LIBNS>$pid</pid></rpc-reply>$"
|
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status><starttime $LIBNS>20[0-9][0-9].[0-9][0-9].[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]*Z</starttime><pid $LIBNS>$pid</pid></rpc-reply>$"
|
||||||
else
|
else
|
||||||
# inactive, no startime or pid
|
# inactive, no startime or pid
|
||||||
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status></rpc-reply>$"
|
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/.*/clixon_restconf -f $cfg -D [0-9] .*</command><status $LIBNS>$status</status></rpc-reply>$"
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue