diff options
author | Carlos Goncalves <carlos.goncalves@neclab.eu> | 2016-03-20 22:23:44 +0100 |
---|---|---|
committer | Carlos Goncalves <carlos.goncalves@neclab.eu> | 2016-03-29 21:45:10 +0200 |
commit | a1bab6ecdfbfaf5521f31d9539e256fc6e0cac29 (patch) | |
tree | 86325cd41d54f06fc2b00dc50ccd4e915b017e01 | |
parent | 5e00dc425941c2b1971030122eaab83b95eede84 (diff) |
Fix disable_network.sh and 'ip' path
The 'ip' bin file can be located in different paths depending on the Linux
distribution so better not hardcode it to a specific path.
CentOS 6: /sbin/ip
CentOS 7: /usr/sbin/ip
Ubuntu 14.04: /sbin/ip
Change-Id: I0b02a221d3367ed4bfd8596992a2774f22138b54
Signed-off-by: Carlos Goncalves <carlos.goncalves@neclab.eu>
-rwxr-xr-x | tests/run.sh | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/run.sh b/tests/run.sh index 7720604c..fc9ec951 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -148,14 +148,14 @@ wait_for_vm_launch() { } inject_failure() { - echo "disabling network of comupte host [$COMPUTE_HOST] for 3 mins..." + echo "disabling network of compute host [$COMPUTE_HOST] for 3 mins..." cat > disable_network.sh << 'END_TXT' #!/bin/bash -x -dev=$(/usr/sbin/ip route | awk '/^default/{print $5}') +dev=$(ip route | awk '/^default/{print $5}') sleep 1 -echo sudo ip link set $dev down +sudo ip link set $dev down sleep 180 -echo sudo ip link set $dev up +sudo ip link set $dev up sleep 1 END_TXT chmod +x disable_network.sh @@ -164,11 +164,10 @@ END_TXT } calculate_notification_time() { - detect=$(grep "doctor monitor detected at" monitor.log | awk '{print $5}') + detected=$(grep "doctor monitor detected at" monitor.log | awk '{print $5}') notified=$(grep "doctor consumer notified at" consumer.log | awk '{print $5}') - duration=$(echo "$notified $detect" | awk '{print $1 - $2 }') - echo "$notified $detect" | \ - awk '{d = $1 - $2; if (d < 1 ) print d " OK"; else print d " NG"}' + echo "$notified $detected" | \ + awk '{d = $1 - $2; if (d < 1 && d > 0) print d " OK"; else print d " NG"}' } cleanup() { |