test script minor modifications
This commit is contained in:
parent
1fa45067a7
commit
87f76c42f8
6 changed files with 31 additions and 11 deletions
|
|
@ -29,7 +29,7 @@ Edit the nginx config file. (On Ubuntu: `/etc/nginx/sites-available/default`, on
|
|||
```
|
||||
server {
|
||||
...
|
||||
location /restconf {
|
||||
location / {
|
||||
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
|
|
|||
28
test/lib.sh
28
test/lib.sh
|
|
@ -5,6 +5,7 @@
|
|||
# - expectfn
|
||||
# - expecteq
|
||||
# - expecteof
|
||||
# - expecteofeq
|
||||
# - expecteofx
|
||||
# - expecteof_file
|
||||
# - expectwait
|
||||
|
|
@ -421,6 +422,10 @@ EOF
|
|||
|
||||
# Like expecteof but with grep -Fxq instead of -EZq. Ie implicit ^$
|
||||
# Use this for fixed all line, ie must match exact.
|
||||
# - Command
|
||||
# - expected command return value (0 if OK)
|
||||
# - stdin input
|
||||
# - expected stdout outcome
|
||||
expecteofx(){
|
||||
cmd=$1
|
||||
retval=$2
|
||||
|
|
@ -463,6 +468,10 @@ EOF
|
|||
# Like expecteof/expecteofx but with test == instead of grep.
|
||||
# No wildcards
|
||||
# Use this for multi-lines
|
||||
# # - Command
|
||||
# - expected command return value (0 if OK)
|
||||
# - stdin input
|
||||
# - expected stdout outcome
|
||||
expecteofeq(){
|
||||
cmd=$1
|
||||
retval=$2
|
||||
|
|
@ -498,13 +507,24 @@ EOF
|
|||
|
||||
|
||||
# clixon tester read from file for large tests
|
||||
# Arguments:
|
||||
# - Command
|
||||
# - Filename to pipe to stdin
|
||||
# - expected stdout outcome
|
||||
expecteof_file(){
|
||||
cmd=$1
|
||||
file=$2
|
||||
expect=$3
|
||||
retval=$2
|
||||
file=$3
|
||||
expect=$4
|
||||
|
||||
# Do while read stuff
|
||||
ret=$($cmd<$file)
|
||||
# Run the command, pipe stdin from file
|
||||
ret=$($cmd<$file)
|
||||
r=$?
|
||||
if [ $r != $retval ]; then
|
||||
echo -e "\e[31m\nError ($r != $retval) in Test$testnr [$testname]:"
|
||||
echo -e "\e[0m:"
|
||||
exit -1
|
||||
fi
|
||||
# Match if both are empty string
|
||||
if [ -z "$ret" -a -z "$expect" ]; then
|
||||
return
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig
|
|||
|
||||
# Now take large config file and write it via netconf to candidate
|
||||
new "netconf write large config"
|
||||
expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" 0 "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
# Now commit it from candidate to running
|
||||
new "netconf commit large config"
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ load(){
|
|||
# Generate file ($fxml)
|
||||
genfile $1 netconf
|
||||
# Write it to backend in one chunk
|
||||
expecteof_file "$clixon_netconf -qf $cfg -y $fyang" "$fxml" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
expecteof_file "$clixon_netconf -qf $cfg -y $fyang" 0 "$fxml" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
}
|
||||
|
||||
# Run an operation, iterate from <from> to <to> in increment of <step>
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig
|
|||
|
||||
# Now take large config file and write it via netconf to candidate
|
||||
new "netconf write large config"
|
||||
expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
expecteof_file "time $clixon_netconf -qf $cfg" 0 "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
# Here, there are $perfnr entries in candidate
|
||||
new "netconf write large config again"
|
||||
expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
expecteof_file "time -f %e $clixon_netconf -qf $cfg" 0 "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
# Now commit it from candidate to running
|
||||
new "netconf commit large config"
|
||||
|
|
@ -208,7 +208,7 @@ done
|
|||
echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig2
|
||||
|
||||
new "netconf replace large list-leaf config"
|
||||
expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig2" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" 0 "$fconfig2" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf commit large leaf-list config"
|
||||
expecteof "/usr/bin/time -f %e $clixon_netconf -qf $cfg" 0 "<rpc><commit/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ echo "</interfaces></config></edit-config></rpc>]]>]]>" >> $fconfig
|
|||
|
||||
# Now take large config file and write it via netconf to candidate
|
||||
new "netconf write large config"
|
||||
expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" 0 "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
# Now commit it from candidate to running
|
||||
new "netconf commit large config"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue