Fix host status grep bug and Remove connection_pool argument
[doctor.git] / tests / run.sh
index c21c3fd..b838ada 100755 (executable)
@@ -30,6 +30,7 @@ DOCTOR_PW=doctor
 DOCTOR_PROJECT=doctor
 DOCTOR_ROLE=_member_
 PROFILER_TYPE=${PROFILER_TYPE:-none}
+PYTHON_ENABLE=${PYTHON_ENABLE:-false}
 
 TOP_DIR=$(cd $(dirname "$0") && pwd)
 
@@ -47,7 +48,7 @@ as_admin_user="--os-username admin --os-project-name $DOCTOR_PROJECT
 get_compute_host_info() {
     # get computer host info which first VM boot in as admin user
     COMPUTE_HOST=$(openstack $as_admin_user server show ${VM_BASENAME}1 |
-                   grep "OS-EXT-SRV-ATTR:host" | awk '{ print $4 }')
+                   grep "OS-EXT-SRV-ATTR:host " | awk '{ print $4 }')
     compute_host_in_undercloud=${COMPUTE_HOST%%.*}
     die_if_not_set $LINENO COMPUTE_HOST "Failed to get compute hostname"
 
@@ -293,8 +294,7 @@ inject_failure() {
     echo "disabling network of compute host [$COMPUTE_HOST] for 3 mins..."
     cat > disable_network.sh << 'END_TXT'
 #!/bin/bash -x
-dev=$(sudo ip a | awk '/ @COMPUTE_IP@\//{print $7}')
-[[ -n "$dev" ]] || dev=$(sudo ip a | awk '/ @COMPUTE_IP@\//{print $5}')
+dev=$(sudo ip a | awk '/ @COMPUTE_IP@\//{print $NF}')
 sleep 1
 sudo ip link set $dev down
 echo "doctor set link down at" $(date "+%s.%N")
@@ -480,6 +480,13 @@ cleanup() {
 
 # Main process
 
+if $PYTHON_ENABLE; then
+    cd $TOP_DIR
+    echo "executing tox..."
+    tox
+    exit $?
+fi
+
 echo "Note: doctor/tests/run.sh has been executed."
 git log --oneline -1 || true   # ignore even you don't have git installed