Internal RESTCONF changes:
- Kill running process directly, not schedul a kill - fcgi: when kill, make exit more ordered, ensure fcgi-accept returns properly
This commit is contained in:
parent
27af25f57b
commit
aaaeec92eb
17 changed files with 116 additions and 56 deletions
|
|
@ -163,6 +163,7 @@ expectpart "$($clixon_util_datastore $conf lock 756)" 0 ""
|
|||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_datastore
|
||||
unset ret
|
||||
|
||||
rm -rf $mydir
|
||||
|
||||
|
|
|
|||
|
|
@ -303,6 +303,8 @@ if [ $BE -ne 0 ]; then
|
|||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
unset ret
|
||||
|
||||
endtest
|
||||
|
||||
rm -rf $dir
|
||||
|
|
|
|||
|
|
@ -243,3 +243,4 @@ unset RESTCONFIG
|
|||
|
||||
# unset conditional parameters
|
||||
unset format
|
||||
unset ret
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ fi
|
|||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
unset ret
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ unset RESTCONFIG
|
|||
unset format
|
||||
unset perfnr
|
||||
unset perfreq
|
||||
unset ret
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ if [ "${WITH_RESTCONF}" = "native" ]; then
|
|||
protos="$protos https"
|
||||
fi
|
||||
for proto in $protos; do
|
||||
# addrs="127.0.0.1"
|
||||
addrs="127.0.0.1"
|
||||
if $IPv6 ; then
|
||||
addrs="$addrs \[::1\]"
|
||||
fi
|
||||
|
|
@ -429,6 +429,7 @@ unset RCPROTO
|
|||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
unset RESTCONFIG1
|
||||
unset ret
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ function rpcstatus()
|
|||
|
||||
sleep $DEMSLEEP
|
||||
new "send rpc status"
|
||||
ret=$($clixon_netconf -qf $cfg<<EOF
|
||||
retx=$($clixon_netconf -qf $cfg<<EOF
|
||||
$DEFAULTHELLO
|
||||
<rpc $DEFAULTNS>
|
||||
<process-control $LIBNS>
|
||||
|
|
@ -90,14 +90,14 @@ EOF
|
|||
)
|
||||
# Check pid
|
||||
expect="<pid $LIBNS>[0-9]*</pid>"
|
||||
match=$(echo "$ret" | grep --null -Go "$expect")
|
||||
match=$(echo "$retx" | grep --null -Go "$expect")
|
||||
if [ -z "$match" ]; then
|
||||
pid=0
|
||||
else
|
||||
pid=$(echo "$match" | awk -F'[<>]' '{print $3}')
|
||||
fi
|
||||
if [ -z "$pid" ]; then
|
||||
err "No pid return value" "$ret"
|
||||
err "No pid return value" "$retx"
|
||||
fi
|
||||
if $active; then
|
||||
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/www-data/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>]]>]]>$"
|
||||
|
|
@ -105,9 +105,9 @@ EOF
|
|||
# inactive, no startime or pid
|
||||
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/www-data/clixon_restconf -f $cfg -D [0-9]</command><status $LIBNS>$status</status></rpc-reply>]]>]]>$"
|
||||
fi
|
||||
match=$(echo "$ret" | grep --null -Go "$expect")
|
||||
match=$(echo "$retx" | grep --null -Go "$expect")
|
||||
if [ -z "$match" ]; then
|
||||
err "$expect" "$ret"
|
||||
err "$expect" "$retx"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ new "4. stop restconf RPC"
|
|||
rpcoperation stop
|
||||
if [ $? -ne 0 ]; then exit -1; fi
|
||||
|
||||
new "Wait for restrconf to stop"
|
||||
new "Wait for restconf to stop"
|
||||
wait_restconf_stopped
|
||||
|
||||
new "5. Get rpc status stopped"
|
||||
|
|
@ -422,7 +422,7 @@ expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-confi
|
|||
new "commit disable"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><commit/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "17. check status RPC off"
|
||||
new "18. check status RPC off"
|
||||
rpcstatus false stopped
|
||||
if [ $pid -ne 0 ]; then err "Pid" "$pid"; fi
|
||||
|
||||
|
|
@ -448,16 +448,19 @@ fi
|
|||
|
||||
#Start backend -s none should start
|
||||
|
||||
unset pid
|
||||
new "kill restconf"
|
||||
stop_restconf
|
||||
|
||||
sleep $DEMSLEEP # Lots of processes need to die before next test
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
||||
# Set by restconf_config
|
||||
unset pid
|
||||
unset RESTCONFIG
|
||||
unset RESTCONFDBG
|
||||
unset RCPROTO
|
||||
unset retx
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ function rpcstatus()
|
|||
|
||||
sleep $DEMSLEEP
|
||||
new "send rpc status"
|
||||
ret=$($clixon_netconf -qf $cfg<<EOF
|
||||
retx=$($clixon_netconf -qf $cfg<<EOF
|
||||
$DEFAULTHELLO
|
||||
<rpc $DEFAULTNS>
|
||||
<process-control $LIBNS>
|
||||
|
|
@ -104,14 +104,14 @@ EOF
|
|||
)
|
||||
# Check pid
|
||||
expect="<pid $LIBNS>[0-9]*</pid>"
|
||||
match=$(echo "$ret" | grep --null -Go "$expect")
|
||||
match=$(echo "$retx" | grep --null -Go "$expect")
|
||||
if [ -z "$match" ]; then
|
||||
pid=0
|
||||
else
|
||||
pid=$(echo "$match" | awk -F'[<>]' '{print $3}')
|
||||
fi
|
||||
if [ -z "$pid" ]; then
|
||||
err "No pid return value" "$ret"
|
||||
err "No pid return value" "$retx"
|
||||
fi
|
||||
if $active; then
|
||||
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/www-data/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>]]>]]>$"
|
||||
|
|
@ -119,9 +119,9 @@ EOF
|
|||
# inactive, no startime or pid
|
||||
expect="^<rpc-reply $DEFAULTNS><active $LIBNS>$active</active><description $LIBNS>Clixon RESTCONF process</description><command $LIBNS>/www-data/clixon_restconf -f $cfg -D [0-9]</command><status $LIBNS>$status</status></rpc-reply>]]>]]>$"
|
||||
fi
|
||||
match=$(echo "$ret" | grep --null -Go "$expect")
|
||||
match=$(echo "$retx" | grep --null -Go "$expect")
|
||||
if [ -z "$match" ]; then
|
||||
err "$expect" "$ret"
|
||||
err "$expect" "$retx"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +142,7 @@ if [ $BE -ne 0 ]; then
|
|||
new "start backend -s init -f $cfg"
|
||||
start_backend -s init -f $cfg
|
||||
fi
|
||||
|
||||
new "wait backend"
|
||||
wait_backend
|
||||
|
||||
|
|
@ -250,9 +251,9 @@ expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><commit/></
|
|||
sleep $DEMSLEEP
|
||||
new "Check zombies"
|
||||
# NOTE unsure where zombies actually appear
|
||||
ret=$(ps aux| grep clixon | grep defunc | grep -v grep)
|
||||
if [ -n "$ret" ]; then
|
||||
err "No zombie process" "$ret"
|
||||
retx=$(ps aux| grep clixon | grep defunc | grep -v grep)
|
||||
if [ -n "$retx" ]; then
|
||||
err "No zombie process" "$retx"
|
||||
fi
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
|
|
@ -269,9 +270,9 @@ fi
|
|||
sleep $DEMSLEEP
|
||||
new "Check zombies again"
|
||||
# NOTE unsure where zombies actually appear
|
||||
ret=$(ps aux| grep clixon | grep defunc | grep -v grep)
|
||||
if [ -n "$ret" ]; then
|
||||
err "No zombie process" "$ret"
|
||||
retx=$(ps aux| grep clixon | grep defunc | grep -v grep)
|
||||
if [ -n "$retx" ]; then
|
||||
err "No zombie process" "$retx"
|
||||
fi
|
||||
|
||||
# THIRD usecase
|
||||
|
|
@ -437,6 +438,9 @@ fi
|
|||
|
||||
fi # "${WITH_RESTCONF}" != "fcgi"
|
||||
|
||||
new "kill restconf"
|
||||
stop_restconf
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ if [ $BE -ne 0 ]; then
|
|||
start_backend -s init -f "$cfg" -- -s
|
||||
fi
|
||||
|
||||
new "waiting"
|
||||
new "wait backend"
|
||||
wait_backend
|
||||
|
||||
if [ $RC -ne 0 ]; then
|
||||
|
|
@ -88,10 +88,12 @@ if [ $RC -ne 0 ]; then
|
|||
new "start restconf daemon"
|
||||
start_restconf -f $cfg
|
||||
|
||||
new "waiting"
|
||||
wait_restconf
|
||||
|
||||
fi
|
||||
|
||||
new "wait restconf"
|
||||
wait_restconf
|
||||
|
||||
new "B.1.1. Retrieve the Top-Level API Resource root"
|
||||
expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/xrd+xml' $RCPROTO://localhost/.well-known/host-meta)" 0 "HTTP/1.1 200 OK" "Content-Type: application/xrd+xml" "<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>" "<Link rel='restconf' href='/restconf'/>" "</XRD>"
|
||||
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ fi
|
|||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
unset ret
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
|
|
|
|||
|
|
@ -367,5 +367,8 @@ fi # valgrindtest
|
|||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
|
||||
unset ret
|
||||
|
||||
endtest
|
||||
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@ function testrun(){
|
|||
x0=$2
|
||||
x1=$3
|
||||
xp=$4
|
||||
ret=$5
|
||||
retx=$5
|
||||
res=$6
|
||||
|
||||
echo "$clixon_util_xml_mod -o $op -y $fyang -b "$x0" -x "$x1" -p $xp $OPTS"
|
||||
expectpart "$($clixon_util_xml_mod -o $op -y $fyang -b "$x0" -x "$x1" -p $xp $OPTS)" $ret "$res"
|
||||
expectpart "$($clixon_util_xml_mod -o $op -y $fyang -b "$x0" -x "$x1" -p $xp $OPTS)" $retx "$res"
|
||||
}
|
||||
|
||||
new "test params: -y $fyang $OPTS"
|
||||
|
|
@ -125,6 +125,7 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_xml_mod
|
||||
unset retx
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -126,5 +126,7 @@ testrun
|
|||
|
||||
rm -rf $dir
|
||||
|
||||
unset ret
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -149,5 +149,7 @@ unset RESTCONFIG
|
|||
|
||||
rm -rf $dir
|
||||
|
||||
unset ret
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue