[sheepdog] [PATCH] test: fix simulate_machine_down helper

Liu Yuan namei.unix at gmail.com
Mon Sep 10 09:21:40 CEST 2012


From: Liu Yuan <tailai.ly at taobao.com>

use $1 instead of mad $i

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 tests/common.rc |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/common.rc b/tests/common.rc
index 06cefad..9c6005c 100644
--- a/tests/common.rc
+++ b/tests/common.rc
@@ -282,8 +282,8 @@ _wait_for_sheep_recovery()
 _simulate_machine_down()
 {
 	# Drop the packet in/out this port
-	iptables -A INPUT -p tcp --sport $((7000+$i)) -j DROP
-	iptables -A INPUT -p tcp --dport $((7000+$i)) -j DROP
+	iptables -A INPUT -p tcp --sport $((7000+$1)) -j DROP
+	iptables -A INPUT -p tcp --dport $((7000+$1)) -j DROP
 
 	sleep 3
 	# Trigger the confchg because cluster driver doesn't know we'er offline
@@ -294,8 +294,8 @@ _simulate_machine_down()
 # Cleanup the iptables rules used to simulate machine down
 _cleanup_machine_simulation()
 {
-	iptables -D INPUT -p tcp --sport $((7000+$i)) -j DROP
-	iptables -D INPUT -p tcp --dport $((7000+$i)) -j DROP
+	iptables -D INPUT -p tcp --sport $((7000+$1)) -j DROP
+	iptables -D INPUT -p tcp --dport $((7000+$1)) -j DROP
 }
 
 # make sure this script returns success
-- 
1.7.10.2




More information about the sheepdog mailing list