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

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


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

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 tests/044     | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/044.out | 48 +++++++++++++++++++++++++++++++++++
 tests/group   |  1 +
 3 files changed, 130 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..9b4862e
--- /dev/null
+++ b/tests/044
@@ -0,0 +1,81 @@
+#!/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
+
+echo there should be no vdi
+$COLLIE vdi list
+
+echo there should be no object
+$COLLIE node info
+
+find /tmp/sheepdog/*/cache -type f | sort
diff --git a/tests/044.out b/tests/044.out
new file mode 100644
index 0000000..f26d387
--- /dev/null
+++ b/tests/044.out
@@ -0,0 +1,48 @@
+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
+/tmp/sheepdog/0/cache/06220b/80000000
+/tmp/sheepdog/0/cache/06220c/80000000
+/tmp/sheepdog/0/cache/06220d/80000000
+/tmp/sheepdog/0/cache/06220e/80000000
+/tmp/sheepdog/0/cache/06220f/80000000
+/tmp/sheepdog/0/cache/062210/80000000
+/tmp/sheepdog/0/cache/062211/80000000
+/tmp/sheepdog/0/cache/062212/80000000
+/tmp/sheepdog/0/cache/062213/80000000
+/tmp/sheepdog/0/cache/062214/80000000
+/tmp/sheepdog/0/cache/062215/80000000
+/tmp/sheepdog/0/cache/062216/80000000
+/tmp/sheepdog/0/cache/0623be/80000000
+/tmp/sheepdog/0/cache/0623bf/80000000
+/tmp/sheepdog/0/cache/0623c0/80000000
+/tmp/sheepdog/0/cache/0623c1/80000000
+/tmp/sheepdog/0/cache/0623c2/80000000
+/tmp/sheepdog/0/cache/0623c3/80000000
+/tmp/sheepdog/0/cache/0623c4/80000000
+/tmp/sheepdog/0/cache/0623c5/80000000
+/tmp/sheepdog/0/cache/0623c6/80000000
+/tmp/sheepdog/0/cache/0623c7/80000000
+/tmp/sheepdog/0/cache/0623c8/80000000
+/tmp/sheepdog/0/cache/0623c9/80000000
+/tmp/sheepdog/0/cache/062571/80000000
+/tmp/sheepdog/0/cache/062572/80000000
+/tmp/sheepdog/0/cache/062573/80000000
+/tmp/sheepdog/0/cache/062574/80000000
+/tmp/sheepdog/0/cache/062575/80000000
+/tmp/sheepdog/0/cache/062576/80000000
+/tmp/sheepdog/0/cache/062577/80000000
+/tmp/sheepdog/0/cache/062578/80000000
+/tmp/sheepdog/0/cache/062579/80000000
+/tmp/sheepdog/0/cache/06257a/80000000
+/tmp/sheepdog/0/cache/06257b/80000000
+/tmp/sheepdog/0/cache/06257c/80000000
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