From 285c22406de5e74104cdd92468bcb6a0705f1eb4 Mon Sep 17 00:00:00 2001 From: Ryota MIBU Date: Fri, 19 Feb 2016 22:11:47 +0900 Subject: test: fix bugs (scp -l and trap ERR) This patch fixes bugs: - '-l' option for scp is different from that of ssh, so remove this option from the common param for scp and ssh. - trap ERR was not executed, so replace it by trap EXIT Change-Id: Id50ff29656fa100f420ae9ccc7a8a19a65a941c8 Signed-off-by: Ryota MIBU (cherry picked from commit eed432fa413d3afeecdd65ef0f73559920012df9) --- tests/run.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index 39f60ca2..80d94b3f 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -47,11 +47,9 @@ prepare_compute_ssh() { # get ssh key from installer node sudo scp $ssh_opts root@"$INSTALLER_IP":/home/stack/.ssh/id_rsa instack_key - if [ ! -r instack_key ]; then - sudo chown $(whoami):$(whoami) instack_key - fi + sudo chown $(whoami):$(whoami) instack_key chmod 400 instack_key - ssh_opts_cpu="$ssh_opts -i instack_key -l heat-admin" + ssh_opts_cpu="$ssh_opts -i instack_key" } download_image() { @@ -140,13 +138,13 @@ inject_failure() { dev=$(/usr/sbin/ip route | awk '/^default/{print $5}') sleep 1 echo sudo ip link set $dev down -sleep 120 +sleep 180 echo sudo ip link set $dev up sleep 1 END_TXT chmod +x disable_network.sh - scp $ssh_opts_cpu disable_network.sh "$COMPUTE_IP:" - ssh $ssh_opts_cpu "$COMPUTE_IP:" 'nohup ./disable_network.sh > disable_network.log 2>&1 &' + scp $ssh_opts_cpu disable_network.sh "heat-admin@$COMPUTE_IP:" + ssh $ssh_opts_cpu "heat-admin@$COMPUTE_IP:" 'nohup ./disable_network.sh > disable_network.log 2>&1 &' } calculate_notification_time() { @@ -163,7 +161,7 @@ cleanup() { stop_monitor stop_inspector stop_consumer - ssh $ssh_opts_cpu $COMPUTE_IP \ + ssh $ssh_opts_cpu "heat-admin@$COMPUTE_IP" \ "[ -e disable_network.log ] && cat disable_network.log" nova service-force-down --unset "$COMPUTE_HOST" nova-compute @@ -187,7 +185,7 @@ echo "Note: doctor/tests/run.sh has been executed." prepare_compute_ssh -trap cleanup ERR +trap cleanup EXIT echo "preparing VM image..." download_image @@ -210,6 +208,4 @@ sleep 10 calculate_notification_time -cleanup - echo "done" -- cgit 1.2.3-korg