[sheepdog] [PATCH v2] tests: add a test to test vdi snapshot functionality concurrently

Liu Yuan namei.unix at gmail.com
Wed Sep 19 07:40:40 CEST 2012


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

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 tests/044     | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/044.out | 12 +++++++++
 tests/group   |  1 +
 3 files changed, 95 insertions(+)
 create mode 100755 tests/044
 create mode 100644 tests/044.out

diff --git a/tests/044 b/tests/044
new file mode 100755
index 0000000..1523ba2
--- /dev/null
+++ b/tests/044
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+# Test vdi snapshot functionality concurrently with object cache enabled
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1        # failure is the default!
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_cleanup
+
+for i in 0 1 2; do
+    _start_sheep $i '-s 4096 -w object:size=1000'
+done
+
+_wait_for_sheep 3
+
+$COLLIE cluster format
+$COLLIE vdi create base1 20M -p 7000
+$COLLIE vdi create base2 20M -p 7001
+$COLLIE vdi create base3 20M -p 7002
+
+for i in `seq 0 4`; do
+    echo $i | $COLLIE vdi write base1 $((i * 4 * 1024 * 1024)) 512
+done &
+
+for i in `seq 0 4`; do
+    echo $i | $COLLIE vdi write base2 $((i * 4 * 1024 * 1024)) 512
+done &
+
+for i in `seq 0 4`; do
+    echo $i | $COLLIE vdi write base3 $((i * 4 * 1024 * 1024)) 512
+done &
+
+wait
+
+$COLLIE vdi snapshot -s snap0 base1 -p 7000
+$COLLIE vdi snapshot -s snap0 base2 -p 7001
+$COLLIE vdi snapshot -s snap0 base3 -p 7002
+sleep 1
+
+for i in `seq 1 10`; do
+	$COLLIE vdi snapshot -s snap$i base1 -p 7000
+	$COLLIE vdi delete -s snap$(($i - 1)) base1 -p 7000
+	sleep 1
+done &
+
+for i in `seq 1 10`; do
+	$COLLIE vdi snapshot -s snap$i base2 -p 7001
+	$COLLIE vdi delete -s snap$(($i - 1)) base2 -p 7001
+	sleep 1
+done &
+
+for i in `seq 1 10`; do
+	$COLLIE vdi snapshot -s snap$i base3 -p 7002
+	$COLLIE vdi delete -s snap$(($i - 1)) base3 -p 7002
+	sleep 1
+done &
+
+wait
+
+$COLLIE vdi delete base1 -p 7000
+$COLLIE vdi delete base2 -p 7001
+$COLLIE vdi delete base3 -p 7002
+$COLLIE vdi delete -s snap10 base1 -p 7000
+$COLLIE vdi delete -s snap10 base2 -p 7001
+$COLLIE vdi delete -s snap10 base3 -p 7002
+
+find /tmp/sheepdog/*/cache -type f | sort
+
+echo there should be no vdi
+$COLLIE vdi list
+
+echo there should be no object
+$COLLIE node info
+
diff --git a/tests/044.out b/tests/044.out
new file mode 100644
index 0000000..7a62854
--- /dev/null
+++ b/tests/044.out
@@ -0,0 +1,12 @@
+QA output created by 044
+using backend farm store
+there should be no vdi
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+there should be no object
+Id	Size	Used	Use%
+ 0	4.0 GB	144 MB	  3%
+ 1	4.0 GB	144 MB	  3%
+ 2	4.0 GB	144 MB	  3%
+Total	12 GB	433 MB	  3%
+
+Total virtual image size	0.0 MB
diff --git a/tests/group b/tests/group
index 49c9382..0db3c6c 100644
--- a/tests/group
+++ b/tests/group
@@ -55,3 +55,4 @@
 041 auto quick vdi
 042 auto quick store
 043 auto quick store
+044 auto quick vdi
-- 
1.7.12.84.gefa6462




More information about the sheepdog mailing list