[sheepdog] [PATCH 2/3] tests/func: add _vdi_list helper

Liu Yuan namei.unix at gmail.com
Mon Aug 12 08:22:51 CEST 2013


Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 tests/functional/016       |    2 +-
 tests/functional/029       |    2 +-
 tests/functional/030       |    8 ++++----
 tests/functional/031       |    4 ++--
 tests/functional/039       |   10 +++++-----
 tests/functional/040       |    4 ++--
 tests/functional/041       |   10 +++++-----
 tests/functional/043       |    2 +-
 tests/functional/044       |    2 +-
 tests/functional/046       |   12 ++++++------
 tests/functional/047       |    2 +-
 tests/functional/048       |    2 +-
 tests/functional/052       |    6 +++---
 tests/functional/059       |    2 +-
 tests/functional/060       |    2 +-
 tests/functional/068       |    2 +-
 tests/functional/072       |    2 +-
 tests/functional/common.rc |    6 ++++++
 18 files changed, 43 insertions(+), 37 deletions(-)

diff --git a/tests/functional/016 b/tests/functional/016
index f9cd5c5..d52fd9c 100755
--- a/tests/functional/016
+++ b/tests/functional/016
@@ -31,7 +31,7 @@ $COLLIE vdi delete -s 1 base
 
 sleep 3
 echo there should be no vdi
-$COLLIE vdi list
+_vdi_list
 
 echo there should be no object
 _node_info
diff --git a/tests/functional/029 b/tests/functional/029
index 711d1e3..ab361f4 100755
--- a/tests/functional/029
+++ b/tests/functional/029
@@ -33,7 +33,7 @@ _wait_for_sheep_recovery 0
 $COLLIE vdi delete clone
 $COLLIE vdi delete -s 1 test2
 
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 for i in `seq 2 4`; do
 	$COLLIE vdi object test$i -i 1;
diff --git a/tests/functional/030 b/tests/functional/030
index a84bab3..7e9daae 100755
--- a/tests/functional/030
+++ b/tests/functional/030
@@ -34,7 +34,7 @@ $COLLIE vdi snapshot test2
 $COLLIE cluster snapshot save s2 $TMPDIR
 $COLLIE cluster snapshot list $TMPDIR | _filter_date
 
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 _cleanup
 for i in `seq 0 3`; do
@@ -44,7 +44,7 @@ _wait_for_sheep 4
 
 _cluster_format -c 3
 $COLLIE cluster snapshot load s1 $TMPDIR
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 $COLLIE vdi read test1 | md5sum > $STORE/csum.11.new
 $COLLIE vdi read test2 | md5sum > $STORE/csum.21.new
@@ -58,7 +58,7 @@ done
 _wait_for_sheep 4
 
 $COLLIE cluster snapshot load s2 $TMPDIR
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 _cleanup
 for i in `seq 0 3`; do
@@ -67,7 +67,7 @@ done
 _wait_for_sheep 4
 
 $COLLIE cluster snapshot load 2 $TMPDIR
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 $COLLIE vdi read -s 2 test1 | md5sum > $STORE/csum.12.new
 $COLLIE vdi read -s 2 test2 | md5sum > $STORE/csum.22.new
diff --git a/tests/functional/031 b/tests/functional/031
index 3195eef..dcb6a42 100755
--- a/tests/functional/031
+++ b/tests/functional/031
@@ -13,7 +13,7 @@ for i in 1 2 3; do
     $COLLIE vdi create test$i ${i}00MB
 done
 
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 $COLLIE cluster shutdown
 _wait_for_sheep_stop
@@ -21,4 +21,4 @@ _wait_for_sheep_stop
 _start_sheep 0
 _wait_for_sheep 1
 
-$COLLIE vdi list | _filter_short_date
+_vdi_list
diff --git a/tests/functional/039 b/tests/functional/039
index 30008dc..74bf2e1 100755
--- a/tests/functional/039
+++ b/tests/functional/039
@@ -20,7 +20,7 @@ $QEMU_IO -c "write 0 512 -P 2" sheepdog:test | _filter_qemu_io
 echo yes | $COLLIE vdi rollback test -s snap1
 $QEMU_IO -c "read 0 512 -P 1" sheepdog:test | _filter_qemu_io
 $COLLIE vdi tree | _filter_short_date
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 $QEMU_IO -c "write 0 512 -P 2" sheepdog:test | _filter_qemu_io
 $COLLIE vdi snapshot test -s snap2
@@ -29,17 +29,17 @@ $QEMU_IO -c "write 0 512 -P 3" sheepdog:test | _filter_qemu_io
 echo yes | $COLLIE vdi rollback test -s snap1
 $QEMU_IO -c "read 0 512 -P 1" sheepdog:test | _filter_qemu_io
 $COLLIE vdi tree | _filter_short_date
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 echo yes | $COLLIE vdi rollback test -s snap2
 $QEMU_IO -c "read 0 512 -P 2" sheepdog:test | _filter_qemu_io
 $COLLIE vdi tree | _filter_short_date
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 echo yes | $COLLIE vdi rollback test -s snap1
 $QEMU_IO -c "read 0 512 -P 1" sheepdog:test | _filter_qemu_io
 $COLLIE vdi tree | _filter_short_date
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 $QEMU_IO -c "write 0 512 -P 3" sheepdog:test | _filter_qemu_io
 $COLLIE vdi snapshot test -s snap3
@@ -53,4 +53,4 @@ echo yes | $COLLIE vdi rollback test -s 5
 echo yes | $COLLIE vdi rollback test -s snap3
 $QEMU_IO -c "read 0 512 -P 3" sheepdog:test | _filter_qemu_io
 $COLLIE vdi tree | _filter_short_date
-$COLLIE vdi list | _filter_short_date
+_vdi_list
diff --git a/tests/functional/040 b/tests/functional/040
index 24fe2d7..2935226 100755
--- a/tests/functional/040
+++ b/tests/functional/040
@@ -19,5 +19,5 @@ _start_sheep 1
 wait $!
 _wait_for_sheep 2
 
-$COLLIE vdi list -p 7000 | _filter_short_date
-$COLLIE vdi list -p 7001 | _filter_short_date
+_vdi_list -p 7000
+_vdi_list -p 7001
diff --git a/tests/functional/041 b/tests/functional/041
index ed9c9f7..f72708d 100755
--- a/tests/functional/041
+++ b/tests/functional/041
@@ -26,7 +26,7 @@ echo 2 | $COLLIE vdi write test 0 512
 $COLLIE vdi snapshot test -s snap3
 
 # check vdis
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 $COLLIE vdi tree | _filter_short_date
 for i in `seq 1 3`; do
     $COLLIE vdi read test -s snap$i | md5sum
@@ -39,19 +39,19 @@ $COLLIE vdi backup test -F snap2 -s snap3 > $STORE/backup.2.3
 
 # restore backups
 $COLLIE vdi restore test -s snap1 < $STORE/backup.1.2
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 $COLLIE vdi tree | _filter_short_date
 
 $COLLIE vdi restore test -s 4 < $STORE/backup.2.3
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 $COLLIE vdi tree | _filter_short_date
 
 $COLLIE vdi restore test -s snap1 < $STORE/backup.1.3
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 $COLLIE vdi tree | _filter_short_date
 
 $COLLIE vdi restore test -s snap2 < $STORE/backup.2.3
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 $COLLIE vdi tree | _filter_short_date
 
 # check vdi contents
diff --git a/tests/functional/043 b/tests/functional/043
index 093cff0..2a59a4e 100755
--- a/tests/functional/043
+++ b/tests/functional/043
@@ -51,7 +51,7 @@ done
 $COLLIE vdi create test2 20M
 
 for i in 0 1 2 4; do
-    $COLLIE vdi list -p 700$i | _filter_short_date
+    _vdi_list -p 700$i
 done
 
 # check whether we can write to a gateway after EIO
diff --git a/tests/functional/044 b/tests/functional/044
index 9c8ca76..75a427c 100755
--- a/tests/functional/044
+++ b/tests/functional/044
@@ -62,7 +62,7 @@ $COLLIE vdi delete -s snap10 base2 -p 7001
 $COLLIE vdi delete -s snap10 base3 -p 7002
 
 echo there should be no vdi
-$COLLIE vdi list
+_vdi_list
 
 echo there should be no object
 _node_info
diff --git a/tests/functional/046 b/tests/functional/046
index 659466b..84b2a21 100755
--- a/tests/functional/046
+++ b/tests/functional/046
@@ -15,25 +15,25 @@ _cluster_format -c 2
 echo "delete snapshot image before current one"
 $COLLIE vdi create test 4G
 $COLLIE vdi snapshot test -s snap
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 $COLLIE vdi delete test -s snap
 $COLLIE vdi delete test -s snap # error
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 $COLLIE vdi delete test
 $COLLIE vdi delete test # error
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 echo "delete current image before snapshot one"
 $COLLIE vdi create test 4G
 $COLLIE vdi snapshot test -s snap
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 $COLLIE vdi delete test
 $COLLIE vdi delete test # error
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 
 $COLLIE vdi delete test -s snap
 $COLLIE vdi delete test -s snap # error
-$COLLIE vdi list | _filter_short_date
+_vdi_list
diff --git a/tests/functional/047 b/tests/functional/047
index b722e48..feda20b 100755
--- a/tests/functional/047
+++ b/tests/functional/047
@@ -31,7 +31,7 @@ _wait_for_sheep 1
 
 sleep 3
 
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 $COLLIE vdi read test 0 512 | tr -d [:cntrl:]
 echo -n ' '
 $COLLIE vdi read test 4M 512 | tr -d [:cntrl:]
diff --git a/tests/functional/048 b/tests/functional/048
index 8662453..b44819e 100755
--- a/tests/functional/048
+++ b/tests/functional/048
@@ -31,7 +31,7 @@ _wait_for_sheep_recovery 0
 
 $COLLIE vdi track test
 $COLLIE vdi track -i 1 test
-$COLLIE vdi list test | _filter_short_date
+_vdi_list test
 $COLLIE vdi list -r test | awk '{$7="MASKED";print $0}'
 
 $COLLIE vdi check test
diff --git a/tests/functional/052 b/tests/functional/052
index d14bf94..679a698 100755
--- a/tests/functional/052
+++ b/tests/functional/052
@@ -21,7 +21,7 @@ done
 _wait_for_sheep 4
 for i in 0 1 2 4; do
     $COLLIE cluster info -p 700$i | _filter_cluster_info
-    $COLLIE vdi list | _filter_short_date
+    _vdi_list
 done
 
 echo yes | $COLLIE cluster recover force
@@ -32,12 +32,12 @@ $COLLIE vdi check test | sort
 
 for i in 0 1 2 4; do
     $COLLIE cluster info -p 700$i | _filter_cluster_info
-    $COLLIE vdi list | _filter_short_date
+    _vdi_list
 done
 
 _start_sheep 3
 _wait_for_sheep 5
 for i in 0 1 2 3 4; do
     $COLLIE cluster info -p 700$i | _filter_cluster_info
-    $COLLIE vdi list | _filter_short_date
+    _vdi_list
 done
diff --git a/tests/functional/059 b/tests/functional/059
index ed7272d..3c133ec 100755
--- a/tests/functional/059
+++ b/tests/functional/059
@@ -26,7 +26,7 @@ _input()
 
 _input | $QEMU_IO sheepdog:test > /dev/null
 
-$COLLIE vdi list | _filter_short_date
+_vdi_list
 $COLLIE vdi tree | _filter_short_date
 
 for i in `seq 1 10`; do
diff --git a/tests/functional/060 b/tests/functional/060
index 9495ef5..b5c1384 100755
--- a/tests/functional/060
+++ b/tests/functional/060
@@ -46,7 +46,7 @@ done
 
 for i in `seq 0 7`; do
     $COLLIE cluster info -p 700$i | _filter_cluster_info > $STORE/cinfo.$i
-    $COLLIE vdi list -p 700$i | _filter_short_date
+    _vdi_list -p 700$i
     for j in `seq 0 3`; do
 	$COLLIE vdi read test$j -p 700$i | md5sum > $STORE/csum.$i.$j &
     done
diff --git a/tests/functional/068 b/tests/functional/068
index 9de2893..3dcdb39 100755
--- a/tests/functional/068
+++ b/tests/functional/068
@@ -31,5 +31,5 @@ done
 
 $COLLIE vdi create test 10M
 for i in 0 1 2; do
-    $COLLIE vdi list | _filter_short_date
+    _vdi_list
 done
diff --git a/tests/functional/072 b/tests/functional/072
index cee96c9..b10f204 100755
--- a/tests/functional/072
+++ b/tests/functional/072
@@ -30,7 +30,7 @@ _wait_for_sheep 3
 _wait_for_sheep_recovery 0
 
 for i in 0 1 2; do
-    $COLLIE vdi list -p $((7000+$i)) | _filter_short_date
+    _vdi_list -p $((7000+$i))
 done
 
 $COLLIE vdi check test
diff --git a/tests/functional/common.rc b/tests/functional/common.rc
index 50a2e69..83fb195 100644
--- a/tests/functional/common.rc
+++ b/tests/functional/common.rc
@@ -504,5 +504,11 @@ _kill_zk_session()
 	fi
 }
 
+_vdi_list()
+{
+	local args=$*
+	$COLLIE vdi list $args | _filter_short_date
+}
+
 # make sure this script returns success
 /bin/true
-- 
1.7.9.5




More information about the sheepdog mailing list