test scripts: replaced sleeps with wait functions

This commit is contained in:
Olof hagsand 2019-07-01 10:32:48 +02:00
parent 1134b084c3
commit a2340c265c
26 changed files with 60 additions and 45 deletions

View file

@ -86,7 +86,20 @@ done
testnr=0
for c in $cmds; do
if [ $testnr != 0 ]; then echo; fi
echo "Mem test for $c"
echo "================="
echo "Mem test $c begin"
length=$(echo "Mem test $c begin" | wc -c)
let i=1
while [ $i -lt $length ]; do
echo -n "="
let i++
done
echo
memonce $c
echo "Mem test $c done"
let i=1
while [ $i -lt $length ]; do
echo -n "="
let i++
done
echo
done

View file

@ -154,7 +154,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
# mandatory-leaf See RFC7950 Sec 7.17

View file

@ -124,7 +124,9 @@ new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
# First vanilla (protocol) case
new "netconf validate empty"

View file

@ -48,7 +48,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "cli read and add entry to existing history"

View file

@ -85,7 +85,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "cli enabled feature"

View file

@ -87,7 +87,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "leafref base config"

View file

@ -115,7 +115,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "minmax: minimal"

View file

@ -124,12 +124,12 @@ fi
new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1
new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
new "auth get"
expecteq "$(curl -u andy:bar -sS -X GET http://localhost/restconf/data/nacm-example:x)" 0 'null

View file

@ -101,7 +101,6 @@ EOF
new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1
new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a
@ -109,7 +108,6 @@ EOF
wait_backend
wait_restconf
#----------- First get
case "$ret1" in
0) ret='{"nacm-example:x": 42}

View file

@ -139,12 +139,12 @@ fi
new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1
new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
new "auth set authentication config"
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc><edit-config><target><candidate/></target><config>$RULES</config></edit-config></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"

View file

@ -148,12 +148,12 @@ fi
new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1
new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
# Set nacm from scratch
nacm(){

View file

@ -148,12 +148,12 @@ fi
new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1
new "start restconf daemon (-a is enable basic authentication)"
start_restconf -f $cfg -- -a
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
new "auth set authentication config"
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc><edit-config><target><candidate/></target><config>$RULES</config></edit-config></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"

View file

@ -162,7 +162,7 @@ if [ $BE -ne 0 ]; then
start_backend -s running -f $cfg -- -s
new "waiting"
sleep $RCWAIT
wait_backend
fi
# STATE (should not be ordered)

View file

@ -68,7 +68,8 @@ testrun(){
start_restconf -f $cfg -y $fyang $option
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
new "restconf put 42"
expecteq "$(curl -s -X PUT http://localhost/restconf/data/example:x/y=42 -d '{"example:y":{"a":"42","b":"42"}}')" 0 ""

View file

@ -50,7 +50,9 @@ new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
new "rpc tests"

View file

@ -86,7 +86,7 @@ testrun(){
start_backend -s $mode -f $cfg -c $dir/extra_db
new "waiting"
sleep $RCWAIT
wait_backend
else
new "Restart backend as eg follows: -Ff $cfg -s $mode -c $dir/extra_db # $BETIMEOUT s"
sleep $BETIMEOUT

View file

@ -121,8 +121,9 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg -l f$flog -- -t /x/y[a=$errnr]"
start_backend -s init -f $cfg -l f$flog -- -t /x/y[a=$errnr] # -t means transaction logging
new "waiting"
sleep $RCWAIT
wait_backend
fi
let nr=0

View file

@ -89,7 +89,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "cli set transitive string"

View file

@ -92,7 +92,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
# RFC test two-field caes

View file

@ -265,7 +265,7 @@ runtest(){
start_backend -s $mode -f $cfg -o "CLICON_XMLDB_MODSTATE=$modstate"
new "waiting"
sleep $RCWAIT
wait_backend
else
new "Restart backend as eg follows: -Ff $cfg -s $mode -o \"CLICON_XMLDB_MODSTATE=$modstate\" ($BETIMEOUT s)"
sleep $BETIMEOUT

View file

@ -254,8 +254,6 @@ if [ $BE -ne 0 ]; then
new "start backend -s $mode -f $cfg"
start_backend -s $mode -f $cfg
fi
new "waiting"
sleep $RCWAIT
new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf
@ -264,7 +262,8 @@ new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
new "Check running db content"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>' "^<rpc-reply><data>$XML</data></rpc-reply>]]>]]>$"

View file

@ -265,8 +265,6 @@ testrun(){
new "start backend -s startup -f $cfg -- -u"
start_backend -s startup -f $cfg -- -u
fi
new "waiting"
sleep $RCWAIT
new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf
@ -275,7 +273,8 @@ testrun(){
start_restconf -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
new "Check running db content"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>' "^<rpc-reply><data>$runxml</data></rpc-reply>]]>]]>$"

View file

@ -112,8 +112,6 @@ if [ $BE -ne 0 ]; then
new "start backend -s $mode -f $cfg"
start_backend -s $mode -f $cfg
fi
new "waiting"
sleep $RCWAIT
new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf
@ -122,7 +120,8 @@ new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
new "Check running db content is failsafe"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>' "^<rpc-reply><data>$SAMEXML</data></rpc-reply>]]>]]>$"

View file

@ -102,7 +102,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "when: add static route"

View file

@ -85,7 +85,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "1. Set newex"
@ -134,7 +134,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "Set oldex"
@ -178,7 +178,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "Set newex"
@ -222,7 +222,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "Set oldex"
@ -266,7 +266,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "Set newex"
@ -312,7 +312,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "Set oldex"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><edit-config><target><candidate/></target><config><oldex xmlns="urn:example:clixon">str</oldex></config></edit-config></rpc>]]>]]>' '^<rpc-reply><ok/></rpc-reply>]]>]]>$'
@ -357,7 +357,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "Set oldex"
@ -403,7 +403,7 @@ if [ $BE -ne 0 ]; then
start_backend -s init -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
fi
new "Set oldex"

View file

@ -83,7 +83,8 @@ new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
sleep $RCWAIT
wait_backend
wait_restconf
new "netconf set x in example1"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config><target><candidate/></target><config><x xmlns="urn:example:clixon1">42</x></config></edit-config></rpc>]]>]]>' '^<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>]]>]]>$'