test: fix DNS issue in test scenario 95/10195/1
authorRyota MIBU <r-mibu@cq.jp.nec.com>
Thu, 18 Feb 2016 03:30:31 +0000 (12:30 +0900)
committerRyota Mibu <r-mibu@cq.jp.nec.com>
Thu, 18 Feb 2016 12:17:59 +0000 (12:17 +0000)
Doctor test was failed due to failure in resolving hostname at [1].

This patch replaces hostname by ip address, and also changes ssh route
from relaying instack VM to direct access from functest container to
the target compute host.

[1] https://build.opnfv.org/ci/view/functest/job/functest-apex-opnfv-jump-1-daily-brahmaputra/38/

Change-Id: I9d4f115cb43ec16540f7d9300d652625685477d5
Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
(cherry picked from commit 9171d14463ae1172a91125a49d8f8a53a36433e9)

tests/run.sh

index 5c58463..ffb349a 100755 (executable)
@@ -41,6 +41,18 @@ if [[ "$COMPUTE_IP" == "none" ]] ; then
                   | awk '/ ctlplane network /{print \$5}'")
 fi
 
+prepare_compute_ssh() {
+    ping -c 1 "$COMPUTE_IP"
+
+    # get ssh key from installer node
+    sudo scp $ssh_opts /home/stack/.ssh/id_rsa instack_key
+    if [ ! -r instack_key ]; then
+        sudo chown $(whoami):$(whoami) instack_key
+    fi
+    chmod 400 instack_key
+    ssh_opts_cpu="$ssh_opts -i instack_key -l heat-admin"
+}
+
 download_image() {
     [ -e "$IMAGE_FILE" ] && return 0
     wget "$IMAGE_URL" -o "$IMAGE_FILE"
@@ -132,11 +144,8 @@ echo sudo ip link set $dev up
 sleep 1
 END_TXT
     chmod +x disable_network.sh
-    sudo scp $ssh_opts disable_network.sh $INSTALLER_IP:
-    ssh_opts_cpu="$ssh_opts -i /home/stack/.ssh/id_rsa"
-    sudo ssh $ssh_opts $INSTALLER_IP \
-        "scp $ssh_opts_cpu disable_network.sh heat-admin@$COMPUTE_HOST: && \
-         ssh $ssh_opts_cpu 'nohup ./disable_network.sh > c 2>&1 &'"
+    scp $ssh_opts_cpu disable_network.sh "$COMPUTE_IP:"
+    ssh $ssh_opts_cpu "$COMPUTE_IP:" 'nohup ./disable_network.sh > disable_network.log 2>&1 &'
 }
 
 calculate_notification_time() {
@@ -153,6 +162,8 @@ cleanup() {
     stop_monitor
     stop_inspector
     stop_consumer
+    ssh $ssh_opts_cpu $COMPUTE_IP \
+        "[ -e disable_network.log ] && cat disable_network.log"
 
     nova service-force-down --unset "$COMPUTE_HOST" nova-compute
     sleep 1
@@ -173,7 +184,7 @@ cleanup() {
 
 echo "Note: doctor/tests/run.sh has been executed."
 
-ping -c 1 "$COMPUTE_IP"
+prepare_compute_ssh
 
 trap cleanup ERR