[sheepdog] [PATCH 2/2] tests/057: fix 057 and 057.out

Liu Yuan namei.unix at gmail.com
Fri May 10 08:41:34 CEST 2013


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

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 tests/057           |   11 +++++------
 tests/057.out       |   48 ++++++++++++++++++++++++------------------------
 tests/common.filter |    5 +++++
 3 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/tests/057 b/tests/057
index e1a33ac..4241f59 100755
--- a/tests/057
+++ b/tests/057
@@ -27,34 +27,33 @@ $COLLIE cluster format
 sleep 1
 $COLLIE vdi create test 100M -P
 
-$COLLIE node md info | awk '{$2="MASKED";print $0}' | _filter_store
+$COLLIE node md info | _filter_md_info
 
 # plug during node event
 _start_sheep 3
 _wait_for_sheep 4
 $COLLIE node md plug  $STORE/0/d3,$STORE/0/d4
 _wait_for_sheep_recovery 0
-$COLLIE node md info | awk '{$2="MASKED";print $0}' | _filter_store
+$COLLIE node md info | _filter_md_info
 $COLLIE vdi check test
 $COLLIE cluster info | _filter_cluster_info
 
 # plug duplicate path
 $COLLIE node md plug  $STORE/0/d3
 $COLLIE node recovery
-$COLLIE node md info | awk '{$2="MASKED";print $0}' | _filter_store
+$COLLIE node md info | _filter_md_info
 
 # unplug
 $COLLIE node md unplug  $STORE/0/d0,$STORE/0/d1
 _wait_for_sheep_recovery 0
-$COLLIE node md info | awk '{$2="MASKED";print $0}' | _filter_store
+$COLLIE node md info | _filter_md_info
 $COLLIE vdi check test
 $COLLIE cluster info | _filter_cluster_info
 
-
 # unplug invalid path
 $COLLIE node md unplug  $STORE/0/d0
 $COLLIE node recovery
-$COLLIE node md info | awk '{$2="MASKED";print $0}' | _filter_store
+$COLLIE node md info | _filter_md_info
 $COLLIE cluster info | _filter_cluster_info
 
 # check stale object purging
diff --git a/tests/057.out b/tests/057.out
index 19bc86c..2039eb0 100644
--- a/tests/057.out
+++ b/tests/057.out
@@ -1,15 +1,15 @@
 QA output created by 057
 using backend farm store
-Id MASKED Use Path
-0 MASKED GB 32 MB STORE/0/d0
-1 MASKED GB 32 MB STORE/0/d1
-2 MASKED GB 40 MB STORE/0/d2
-Id MASKED Use Path
-0 MASKED GB 4.0 MB STORE/0/d0
-1 MASKED GB 20 MB STORE/0/d1
-2 MASKED GB 28 MB STORE/0/d2
-3 MASKED GB 20 MB STORE/0/d3
-4 MASKED GB 24 MB STORE/0/d4
+Id	Used	Free	Path
+0 32 MB MASKED GB STORE/0/d0
+1 32 MB MASKED GB STORE/0/d1
+2 40 MB MASKED GB STORE/0/d2
+Id	Used	Free	Path
+0 4.0 MB MASKED GB STORE/0/d0
+1 20 MB MASKED GB STORE/0/d1
+2 28 MB MASKED GB STORE/0/d2
+3 20 MB MASKED GB STORE/0/d3
+4 24 MB MASKED GB STORE/0/d4
 finish check&repair test
 Cluster status: running
 
@@ -21,16 +21,16 @@ DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002]
 Failed to execute request, look for sheep.log for more information
 Nodes In Recovery:
   Id   Host:Port         V-Nodes       Zone
-Id MASKED Use Path
-0 MASKED GB 4.0 MB STORE/0/d0
-1 MASKED GB 20 MB STORE/0/d1
-2 MASKED GB 28 MB STORE/0/d2
-3 MASKED GB 20 MB STORE/0/d3
-4 MASKED GB 24 MB STORE/0/d4
-Id MASKED Use Path
-0 MASKED GB 28 MB STORE/0/d2
-1 MASKED GB 32 MB STORE/0/d3
-2 MASKED GB 36 MB STORE/0/d4
+Id	Used	Free	Path
+0 4.0 MB MASKED GB STORE/0/d0
+1 20 MB MASKED GB STORE/0/d1
+2 28 MB MASKED GB STORE/0/d2
+3 20 MB MASKED GB STORE/0/d3
+4 24 MB MASKED GB STORE/0/d4
+Id	Used	Free	Path
+0 28 MB MASKED GB STORE/0/d2
+1 32 MB MASKED GB STORE/0/d3
+2 36 MB MASKED GB STORE/0/d4
 finish check&repair test
 Cluster status: running
 
@@ -42,10 +42,10 @@ DATE      1 [127.0.0.1:7000, 127.0.0.1:7001, 127.0.0.1:7002]
 Failed to execute request, look for sheep.log for more information
 Nodes In Recovery:
   Id   Host:Port         V-Nodes       Zone
-Id MASKED Use Path
-0 MASKED GB 28 MB STORE/0/d2
-1 MASKED GB 32 MB STORE/0/d3
-2 MASKED GB 36 MB STORE/0/d4
+Id	Used	Free	Path
+0 28 MB MASKED GB STORE/0/d2
+1 32 MB MASKED GB STORE/0/d3
+2 36 MB MASKED GB STORE/0/d4
 Cluster status: running
 
 Cluster created at DATE
diff --git a/tests/common.filter b/tests/common.filter
index ad3924c..019f952 100644
--- a/tests/common.filter
+++ b/tests/common.filter
@@ -163,5 +163,10 @@ _filter_store()
     sed -e "s|$STORE|STORE|g"
 }
 
+_filter_md_info()
+{
+	awk '{if ($4 ~ /^[0-9]+$/) $4="MASKED";print $0}' | _filter_store
+}
+
 # make sure this script returns success
 /bin/true
-- 
1.7.9.5




More information about the sheepdog mailing list