restconf-rpc tests

This commit is contained in:
Olof hagsand 2020-12-15 17:22:07 +01:00
parent 475e70d773
commit ff8650c748
2 changed files with 22 additions and 6 deletions

View file

@ -60,7 +60,6 @@
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/resource.h>
@ -288,7 +287,7 @@ clixon_proc_background(char **argv,
*pid0 = child;
retval = 0;
quit:
clicon_debug(1, "%s retval:%d child:%d", __FUNCTION__, retval, child);
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
return retval;
}

View file

@ -67,6 +67,9 @@ new "start restconf"
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><process-control xmlns=\"http://clicon.org/lib\"><name>restconf</name><operation>start</operation></process-control></rpc>]]>]]>" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>"
new "3)check restconf on"
if [ $valgrindtest -eq 0 ]; then # Cant get pgrep to work properly
sleep $DEMWAIT # Slows the tests down considerably, but needed in eg docker test
fi
ps=$(ps aux|grep "$WWWDIR/clixon_restconf -f $cfg" | grep -v grep)
if [ -z "$ps" ]; then
err "restconf running"
@ -82,6 +85,9 @@ new "start restconf again"
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><process-control xmlns=\"http://clicon.org/lib\"><name>restconf</name><operation>start</operation></process-control></rpc>]]>]]>" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>"
new "5)check restconf on"
if [ $valgrindtest -eq 0 ]; then # Cant get pgrep to work properly
sleep $DEMWAIT # Slows the tests down considerably, but needed in eg docker test
fi
ps=$(ps aux|grep "$WWWDIR/clixon_restconf -f $cfg" | grep -v grep)
if [ -z "$ps" ]; then
err "A restconf running"
@ -102,6 +108,9 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><process-control xmlns=\
new "7)check status on"
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><process-control xmlns=\"http://clicon.org/lib\"><name>restconf</name><operation>status</operation></process-control></rpc>]]>]]>" "<rpc-reply $DEFAULTNS><status xmlns=\"http://clicon.org/lib\">true</status></rpc-reply>]]>]]>"
if [ $valgrindtest -eq 0 ]; then # Cant get pgrep to work properly
sleep $DEMWAIT # Slows the tests down considerably, but needed in eg docker test
fi
pid0=$(pgrep clixon_restconf)
new "restart restconf"
@ -112,7 +121,11 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><process-control xmlns=\
if [ $valgrindtest -eq 0 ]; then # Cant get pgrep to work properly
new "9)check new pid"
sleep $DEMWAIT # Slows the tests down considerably, but needed in eg docker test
pid1=$(pgrep clixon_restconf)
if [ -z "$pid0" -o -z "$pid1" ]; then
err "Pids expected" "pid0:$pid0 = pid1:$pid1"
fi
if [ $pid0 -eq $pid1 ]; then
err "Different pids" "pid0:$pid0 = pid1:$pid1"
fi
@ -128,12 +141,16 @@ if [ $BE -ne 0 ]; then
# kill backend
stop_backend -f $cfg
# XXX Cant get this to work in docker/alpine
if false; then
new "10)check no restconf"
sleep $DEMWAIT
ps=$(ps aux|grep "$WWWDIR/clixon_restconf" | grep -v grep)
if [ -n "$ps" ]; then
err "No restconf running" "$ps"
fi
fi
fi
if false; then # Work in progress
#-------------------------------