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 {
|
server {
|
||||||
...
|
...
|
||||||
location /restconf {
|
location / {
|
||||||
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
|
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
28
test/lib.sh
28
test/lib.sh
|
|
@ -5,6 +5,7 @@
|
||||||
# - expectfn
|
# - expectfn
|
||||||
# - expecteq
|
# - expecteq
|
||||||
# - expecteof
|
# - expecteof
|
||||||
|
# - expecteofeq
|
||||||
# - expecteofx
|
# - expecteofx
|
||||||
# - expecteof_file
|
# - expecteof_file
|
||||||
# - expectwait
|
# - expectwait
|
||||||
|
|
@ -421,6 +422,10 @@ EOF
|
||||||
|
|
||||||
# Like expecteof but with grep -Fxq instead of -EZq. Ie implicit ^$
|
# Like expecteof but with grep -Fxq instead of -EZq. Ie implicit ^$
|
||||||
# Use this for fixed all line, ie must match exact.
|
# Use this for fixed all line, ie must match exact.
|
||||||
|
# - Command
|
||||||
|
# - expected command return value (0 if OK)
|
||||||
|
# - stdin input
|
||||||
|
# - expected stdout outcome
|
||||||
expecteofx(){
|
expecteofx(){
|
||||||
cmd=$1
|
cmd=$1
|
||||||
retval=$2
|
retval=$2
|
||||||
|
|
@ -463,6 +468,10 @@ EOF
|
||||||
# Like expecteof/expecteofx but with test == instead of grep.
|
# Like expecteof/expecteofx but with test == instead of grep.
|
||||||
# No wildcards
|
# No wildcards
|
||||||
# Use this for multi-lines
|
# Use this for multi-lines
|
||||||
|
# # - Command
|
||||||
|
# - expected command return value (0 if OK)
|
||||||
|
# - stdin input
|
||||||
|
# - expected stdout outcome
|
||||||
expecteofeq(){
|
expecteofeq(){
|
||||||
cmd=$1
|
cmd=$1
|
||||||
retval=$2
|
retval=$2
|
||||||
|
|
@ -498,13 +507,24 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
# clixon tester read from file for large tests
|
# clixon tester read from file for large tests
|
||||||
|
# Arguments:
|
||||||
|
# - Command
|
||||||
|
# - Filename to pipe to stdin
|
||||||
|
# - expected stdout outcome
|
||||||
expecteof_file(){
|
expecteof_file(){
|
||||||
cmd=$1
|
cmd=$1
|
||||||
file=$2
|
retval=$2
|
||||||
expect=$3
|
file=$3
|
||||||
|
expect=$4
|
||||||
|
|
||||||
# Do while read stuff
|
# Run the command, pipe stdin from file
|
||||||
ret=$($cmd<$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
|
# Match if both are empty string
|
||||||
if [ -z "$ret" -a -z "$expect" ]; then
|
if [ -z "$ret" -a -z "$expect" ]; then
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig
|
||||||
|
|
||||||
# Now take large config file and write it via netconf to candidate
|
# Now take large config file and write it via netconf to candidate
|
||||||
new "netconf write large config"
|
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
|
# Now commit it from candidate to running
|
||||||
new "netconf commit large config"
|
new "netconf commit large config"
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ load(){
|
||||||
# Generate file ($fxml)
|
# Generate file ($fxml)
|
||||||
genfile $1 netconf
|
genfile $1 netconf
|
||||||
# Write it to backend in one chunk
|
# 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>
|
# 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
|
# Now take large config file and write it via netconf to candidate
|
||||||
new "netconf write large config"
|
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
|
# Here, there are $perfnr entries in candidate
|
||||||
new "netconf write large config again"
|
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
|
# Now commit it from candidate to running
|
||||||
new "netconf commit large config"
|
new "netconf commit large config"
|
||||||
|
|
@ -208,7 +208,7 @@ done
|
||||||
echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig2
|
echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig2
|
||||||
|
|
||||||
new "netconf replace large list-leaf config"
|
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"
|
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>]]>]]>$"
|
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
|
# Now take large config file and write it via netconf to candidate
|
||||||
new "netconf write large config"
|
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
|
# Now commit it from candidate to running
|
||||||
new "netconf commit large config"
|
new "netconf commit large config"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue