Always use variable substition for command
Can't do a sudo inside an expect so we run the expect inside the sudo.
This commit is contained in:
parent
5919ba6c6a
commit
62401b72d0
5 changed files with 18 additions and 11 deletions
|
|
@ -186,7 +186,7 @@ BUSER=clicon
|
|||
|
||||
: ${clixon_cli:=clixon_cli}
|
||||
|
||||
: ${clixon_netconf:=$(which clixon_netconf)}
|
||||
: ${clixon_netconf:=clixon_netconf}
|
||||
|
||||
: ${clixon_restconf:=clixon_restconf}
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ function wait_backend(){
|
|||
while [[ $reply != *"<rpc-reply"* ]]; do
|
||||
# echo "sleep $DEMSLEEP"
|
||||
sleep $DEMSLEEP
|
||||
reply=$(echo "<rpc $ÐEFAULTSNS $LIBNS><ping/></rpc>]]>]]>" | clixon_netconf -qef $cfg 2> /dev/null)
|
||||
reply=$(echo "<rpc $ÐEFAULTSNS $LIBNS><ping/></rpc>]]>]]>" | $clixon_netconf -qef $cfg 2> /dev/null)
|
||||
# echo "reply:$reply"
|
||||
let i++;
|
||||
# echo "wait_backend $i"
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ reset
|
|||
tmppipe=$(mktemp -u)
|
||||
mkfifo -m 600 "$tmppipe"
|
||||
|
||||
cat << EOF | clixon_cli -f $cfg >> /dev/null &
|
||||
cat << EOF | $clixon_cli -f $cfg >> /dev/null &
|
||||
set table parameter eth0
|
||||
commit confirmed 60
|
||||
shell echo >> $tmppipe
|
||||
|
|
@ -349,7 +349,7 @@ rm $tmppipe
|
|||
new "14. cli persistent confirmed-commit"
|
||||
reset
|
||||
|
||||
cat << EOF | clixon_cli -f $cfg >> /dev/null
|
||||
cat << EOF | $clixon_cli -f $cfg >> /dev/null
|
||||
set table parameter eth0
|
||||
commit confirmed persist a
|
||||
quit
|
||||
|
|
@ -357,7 +357,7 @@ EOF
|
|||
|
||||
assert_config_equals "running" "$CONFIGB"
|
||||
|
||||
cat << EOF | clixon_cli -f $cfg >> /dev/null
|
||||
cat << EOF | $clixon_cli -f $cfg >> /dev/null
|
||||
set table parameter eth1
|
||||
commit persist-id a confirmed persist ab
|
||||
quit
|
||||
|
|
@ -384,7 +384,7 @@ expectpart "$($clixon_cli -lo -1 -f $cfg commit persist-id ab cancel)" 255 "no c
|
|||
|
||||
new "18. cli persistent confirmed-commit with timeout"
|
||||
reset
|
||||
cat << EOF | clixon_cli -f $cfg >> /dev/null
|
||||
cat << EOF | $clixon_cli -f $cfg >> /dev/null
|
||||
set table parameter eth0
|
||||
commit confirmed persist abcd 3
|
||||
EOF
|
||||
|
|
@ -396,13 +396,13 @@ assert_config_equals "running" ""
|
|||
|
||||
new "19. cli persistent confirmed-commit with reset timeout"
|
||||
reset
|
||||
cat << EOF | clixon_cli -f $cfg >> /dev/null
|
||||
cat << EOF | $clixon_cli -f $cfg >> /dev/null
|
||||
set table parameter eth0
|
||||
commit confirmed persist abcd 5
|
||||
EOF
|
||||
|
||||
assert_config_equals "running" "$CONFIGB"
|
||||
cat << EOF | clixon_cli -f $cfg >> /dev/null
|
||||
cat << EOF | $clixon_cli -f $cfg >> /dev/null
|
||||
set table parameter eth1
|
||||
commit persist-id abcd confirmed persist abcdef 10
|
||||
EOF
|
||||
|
|
|
|||
|
|
@ -160,7 +160,9 @@ wait_backend
|
|||
|
||||
xpath="/es:members/es:member[es:member-id=\'bob\']/es:favorites/es:uint64-numbers"
|
||||
new "cli show pagination config using expect"
|
||||
expect ./test_pagination_expect.exp "$cfg" "$xpath" "uint64-numbers 18" "uint64-numbers 19"
|
||||
sudo="sudo -g ${CLICON_USER}" ## cheat
|
||||
clixon_cli_="${clixon_cli##$sudo }"
|
||||
clixon_cli="$clixon_cli_" $sudo --preserve-env=clixon_cli expect ./test_pagination_expect.exp "$cfg" "$xpath" "uint64-numbers 18" "uint64-numbers 19"
|
||||
if [ $? -ne 0 ]; then
|
||||
err1 "Failed: CLI show paginate config scroll using expect"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ set stty_init "rows 20 cols 128"
|
|||
|
||||
send_user "\nTest State paginate cli scrolling\n"
|
||||
|
||||
# grab $clixon_cli from environment
|
||||
set clixon_cli $::env(clixon_cli)
|
||||
|
||||
set cfg [lindex $argv 0]
|
||||
set xpath [lindex $argv 1]
|
||||
set line1 [lindex $argv 2]
|
||||
|
|
@ -21,7 +24,7 @@ set line2 [lindex $argv 3]
|
|||
|
||||
set timeout 15
|
||||
|
||||
spawn clixon_cli -f $cfg
|
||||
spawn $clixon_cli -f $cfg
|
||||
|
||||
send "show pagination xpath $xpath cli\n"
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,9 @@ if [ -n "$(type expect 2> /dev/null)" ]; then
|
|||
testrun_start "/es:audit-logs/es:audit-log"
|
||||
|
||||
new "CLI scroll test using expect"
|
||||
expect ./test_pagination_expect.exp "$cfg" "$xpath" bob3 bob4
|
||||
sudo="sudo -g ${CLICON_USER}" ## cheat
|
||||
clixon_cli_="${clixon_cli##$sudo }"
|
||||
clixon_cli="$clixon_cli_" $sudo --preserve-env=clixon_cli expect ./test_pagination_expect.exp "$cfg" "$xpath" bob3 bob4
|
||||
if [ $? -ne 0 ]; then
|
||||
err1 "Failed: CLI show paginate state scroll using expect"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue