test: sleep 0.5s; vagrant centos: ipv6 enable

This commit is contained in:
Olof hagsand 2020-11-24 18:29:04 +01:00
parent 8d8a37d18e
commit ccadd3f9ea
5 changed files with 19 additions and 16 deletions

View file

@ -45,7 +45,7 @@ You can prefix a test with `BE=0` if you want to run your own backend.
To run with debug flags, use the `DBG=<number>` environment variable.
Other variables include:
* RCWAIT Number of seconds to sleep after daemons have started
* DEMWAIT Number of seconds to sleep after daemons have started
## Run all tests

View file

@ -113,11 +113,15 @@ DEFAULTNS='xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"'
# Wait after daemons (backend/restconf) start. See mem.sh for valgrind
if [ "$(uname -m)" = "armv7l" ]; then
: ${RCWAIT:=8}
: ${DEMWAIT:=8}
else
: ${RCWAIT:=2}
: ${DEMWAIT:=2}
fi
# Multiplication factor to sleep less than whole seconds
DEMSLEEP=.5
let DEMWAIT*=2;
# RESTCONF protocol, eg http or https
: ${RCPROTO:=http}
@ -276,12 +280,12 @@ wait_backend(){
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"><ping xmlns="http://clicon.org/lib"/></rpc>]]>]]>' | $clixon_netconf -qef $cfg 2> /dev/null)
let i=0;
while [[ $reply != "<rpc-reply"* ]]; do
sleep 1
sleep $DEMSLEEP
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101" xmlns="http://clicon.org/lib"><ping/></rpc>]]>]]>' | clixon_netconf -qef $cfg 2> /dev/null)
let i++;
# echo "wait_backend $i"
if [ $i -ge $RCWAIT ]; then
err "backend timeout $RCWAIT seconds"
if [ $i -ge $DEMWAIT ]; then
err "backend timeout $DEMWAIT seconds"
fi
done
}
@ -324,13 +328,13 @@ wait_restconf(){
# echo "hdr:\"$hdr\""
let i=0;
while [[ $hdr != *"200 OK"* ]]; do
sleep 1
sleep $DEMSLEEP
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf)
# echo "hdr:\"$hdr\""
let i++;
# echo "wait_restconf $i"
if [ $i -ge $RCWAIT ]; then
err "restconf timeout $RCWAIT seconds"
if [ $i -ge $DEMWAIT ]; then
err "restconf timeout $DEMWAIT seconds"
fi
done
if [ $valgrindtest -eq 3 ]; then

View file

@ -17,17 +17,17 @@ memonce(){
case "$what" in
'cli')
valgrindtest=1
: ${RCWAIT:=5} # valgrind backend needs some time to get up
: ${DEMWAIT:=5} # valgrind backend needs some time to get up
clixon_cli="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_cli"
;;
'netconf')
valgrindtest=1
: ${RCWAIT:=5} # valgrind backend needs some time to get up
: ${DEMWAIT:=5} # valgrind backend needs some time to get up
clixon_netconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_netconf"
;;
'backend')
valgrindtest=2 # This means backend valgrind test
: ${RCWAIT:=10} # valgrind backend needs some time to get up
: ${DEMWAIT:=10} # valgrind backend needs some time to get up
clixon_backend="/usr/bin/valgrind --num-callers=50 --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=yes --log-file=$valgrindfile clixon_backend"
;;
@ -35,7 +35,7 @@ memonce(){
valgrindtest=3 # This means backend valgrind test
sudo chmod 660 $valgrindfile
sudo chown www-data $valgrindfile
: ${RCWAIT:=15} # valgrind backend needs some time to get up
: ${DEMWAIT:=15} # valgrind backend needs some time to get up
clixon_restconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile /www-data/clixon_restconf"
;;

View file

@ -335,8 +335,7 @@ if $run; then
start_restconf -f $cfg -y $fyang
new "waiting"
sleep $RCWAIT
sleep $DEMWAIT
to=$to0
step=$step0

View file

@ -137,7 +137,7 @@ case $release in
;;
centos)
# enable ipv6
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
$sshcmd sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# add restconf user: $wwwuser
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo useradd -M $wwwuser