[sheepdog] [PATCH 4/4] tests: add test to check vdi backup and restore

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Sun Sep 9 18:41:34 CEST 2012


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 tests/041     |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/041.out |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/group   |    1 +
 3 files changed, 137 insertions(+), 0 deletions(-)
 create mode 100755 tests/041
 create mode 100644 tests/041.out

diff --git a/tests/041 b/tests/041
new file mode 100755
index 0000000..aa904a5
--- /dev/null
+++ b/tests/041
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+# Test vdi backup and restore
+
+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 `seq 0 4`; do
+    _start_sheep $i
+done
+
+_wait_for_sheep 5
+
+$COLLIE cluster format
+$COLLIE vdi create test 12M
+
+# create the first object
+echo 0 | $COLLIE vdi write test 0 512
+$COLLIE vdi snapshot test -s snap1
+
+# create the second object
+echo 1 | $COLLIE vdi write test $((4 * 1024 * 1024)) 512
+$COLLIE vdi snapshot test -s snap2
+
+# update the first object
+echo 2 | $COLLIE vdi write test 0 512
+$COLLIE vdi snapshot test -s snap3
+
+# check vdis
+$COLLIE vdi list | _filter_short_date
+$COLLIE vdi tree | _filter_short_date
+for i in `seq 1 3`; do
+    $COLLIE vdi read test -s snap$i | md5sum
+done
+
+# create backup files between snapshots
+$COLLIE vdi backup test -F snap1 -s snap2 /tmp/backup.1.2
+$COLLIE vdi backup test -F snap1 -s snap3 /tmp/backup.1.3
+$COLLIE vdi backup test -F snap2 -s snap3 /tmp/backup.2.3
+
+# restore backups
+$COLLIE vdi restore test -s snap1 /tmp/backup.1.2
+$COLLIE vdi list | _filter_short_date
+$COLLIE vdi tree | _filter_short_date
+
+$COLLIE vdi restore test -s 4 /tmp/backup.2.3
+$COLLIE vdi list | _filter_short_date
+$COLLIE vdi tree | _filter_short_date
+
+$COLLIE vdi restore test -s snap1 /tmp/backup.1.3
+$COLLIE vdi list | _filter_short_date
+$COLLIE vdi tree | _filter_short_date
+
+$COLLIE vdi restore test -s snap2 /tmp/backup.2.3
+$COLLIE vdi list | _filter_short_date
+$COLLIE vdi tree | _filter_short_date
+
+# check vdi contents
+$COLLIE vdi read test | md5sum
+for i in `seq 1 $($COLLIE vdi list | grep "^s " | wc -l)`; do
+    $COLLIE vdi read test -s $i | md5sum
+done
diff --git a/tests/041.out b/tests/041.out
new file mode 100644
index 0000000..220a6b3
--- /dev/null
+++ b/tests/041.out
@@ -0,0 +1,64 @@
+QA output created by 041
+using backend farm store
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+s test         1   12 MB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
+s test         2   12 MB  4.0 MB  4.0 MB DATE   7c2b26     3         snap2
+s test         3   12 MB  4.0 MB  4.0 MB DATE   7c2b27     3         snap3
+  test         4   12 MB  0.0 MB  8.0 MB DATE   7c2b28     3              
+test---[DATE]---[DATE]---[DATE]---(you are here)
+b6338c1861851820f8d289c3b4e6443c  -
+1885611ba75e996f619e8eaf136366e6  -
+d210baf5c55b42b5e0edf04a8535ad6d  -
+restoring /tmp/backup.1.2... done
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+s test         1   12 MB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
+s test         2   12 MB  4.0 MB  4.0 MB DATE   7c2b26     3         snap2
+s test         3   12 MB  4.0 MB  4.0 MB DATE   7c2b27     3         snap3
+s test         4   12 MB  4.0 MB  4.0 MB DATE   7c2b29     3              
+  test         5   12 MB  0.0 MB  8.0 MB DATE   7c2b2a     3              
+test---[DATE]-+-[DATE]---[DATE]---(you are here)
+                          `-[DATE]
+restoring /tmp/backup.2.3... done
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+s test         1   12 MB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
+s test         2   12 MB  4.0 MB  4.0 MB DATE   7c2b26     3         snap2
+s test         3   12 MB  4.0 MB  4.0 MB DATE   7c2b27     3         snap3
+s test         4   12 MB  4.0 MB  4.0 MB DATE   7c2b29     3              
+s test         5   12 MB  4.0 MB  4.0 MB DATE   7c2b2b     3              
+  test         6   12 MB  0.0 MB  8.0 MB DATE   7c2b2c     3              
+test---[DATE]-+-[DATE]---[DATE]---(you are here)
+                          `-[DATE]---[DATE]
+restoring /tmp/backup.1.3... done
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+s test         1   12 MB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
+s test         2   12 MB  4.0 MB  4.0 MB DATE   7c2b26     3         snap2
+s test         3   12 MB  4.0 MB  4.0 MB DATE   7c2b27     3         snap3
+s test         4   12 MB  4.0 MB  4.0 MB DATE   7c2b29     3              
+s test         5   12 MB  4.0 MB  4.0 MB DATE   7c2b2b     3              
+s test         6   12 MB  8.0 MB  0.0 MB DATE   7c2b2d     3              
+  test         7   12 MB  0.0 MB  8.0 MB DATE   7c2b2e     3              
+test---[DATE]-+-[DATE]---[DATE]---(you are here)
+                          |-[DATE]---[DATE]
+                          `-[DATE]
+restoring /tmp/backup.2.3... done
+  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
+s test         1   12 MB  4.0 MB  0.0 MB DATE   7c2b25     3         snap1
+s test         2   12 MB  4.0 MB  4.0 MB DATE   7c2b26     3         snap2
+s test         3   12 MB  4.0 MB  4.0 MB DATE   7c2b27     3         snap3
+s test         4   12 MB  4.0 MB  4.0 MB DATE   7c2b29     3              
+s test         5   12 MB  4.0 MB  4.0 MB DATE   7c2b2b     3              
+s test         6   12 MB  8.0 MB  0.0 MB DATE   7c2b2d     3              
+s test         7   12 MB  4.0 MB  4.0 MB DATE   7c2b2f     3              
+  test         8   12 MB  0.0 MB  8.0 MB DATE   7c2b30     3              
+test---[DATE]-+-[DATE]-+-[DATE]---(you are here)
+                          |                    `-[DATE]
+                          |-[DATE]---[DATE]
+                          `-[DATE]
+d210baf5c55b42b5e0edf04a8535ad6d  -
+b6338c1861851820f8d289c3b4e6443c  -
+1885611ba75e996f619e8eaf136366e6  -
+d210baf5c55b42b5e0edf04a8535ad6d  -
+1885611ba75e996f619e8eaf136366e6  -
+d210baf5c55b42b5e0edf04a8535ad6d  -
+d210baf5c55b42b5e0edf04a8535ad6d  -
+d210baf5c55b42b5e0edf04a8535ad6d  -
diff --git a/tests/group b/tests/group
index 6f9df67..8752c08 100644
--- a/tests/group
+++ b/tests/group
@@ -52,3 +52,4 @@
 038 auto quick cluster
 039 auto quick vdi
 040 auto quick cluster
+041 auto quick vdi
-- 
1.7.2.5




More information about the sheepdog mailing list