[sheepdog] [PATCH v4 18/18] test: add tests/030 for cluster snapshot
Kai Zhang
kyle at zelin.io
Fri May 17 08:27:26 CEST 2013
Signed-off-by: Kai Zhang <kyle at zelin.io>
---
tests/030 | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/030.out | 29 +++++++++++++++
2 files changed, 141 insertions(+), 0 deletions(-)
create mode 100755 tests/030
create mode 100644 tests/030.out
diff --git a/tests/030 b/tests/030
new file mode 100755
index 0000000..8ce32e2
--- /dev/null
+++ b/tests/030
@@ -0,0 +1,112 @@
+#!/bin/bash
+
+# Test cluster snapshot
+
+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 3`; do
+ _start_sheep $i;
+done
+
+_wait_for_sheep 4
+
+TMPDIR=`mktemp -d`
+
+$COLLIE cluster format -c 3
+
+$COLLIE vdi create test1 10M
+$COLLIE vdi create test2 10M
+
+_random | $COLLIE vdi write test1
+_random | $COLLIE vdi write test2
+$COLLIE vdi read test1 | md5sum > /tmp/csum.11.org
+$COLLIE vdi read test2 | md5sum > /tmp/csum.21.org
+$COLLIE vdi snapshot test1
+$COLLIE vdi snapshot test2
+
+$COLLIE cluster snapshot save s1 $TMPDIR
+$COLLIE cluster snapshot list $TMPDIR | _filter_date
+
+_random | $COLLIE vdi write test1
+_random | $COLLIE vdi write test2
+$COLLIE vdi read test1 | md5sum > /tmp/csum.12.org
+$COLLIE vdi read test2 | md5sum > /tmp/csum.22.org
+$COLLIE vdi snapshot test1
+$COLLIE vdi snapshot test2
+
+$COLLIE cluster snapshot save s2 $TMPDIR
+$COLLIE cluster snapshot list $TMPDIR | _filter_date
+
+$COLLIE vdi list | _filter_short_date
+
+for i in `seq 0 3`; do
+ _kill_sheep $i
+ _wait_for_sheep_stop $i
+done
+
+_cleanup
+
+for i in `seq 0 3`; do
+ _start_sheep $i;
+done
+
+_wait_for_sheep 4
+
+$COLLIE cluster format -c 3
+$COLLIE cluster snapshot load s1 $TMPDIR
+
+$COLLIE vdi list | _filter_short_date
+
+$COLLIE vdi read test1 | md5sum > /tmp/csum.11.new
+$COLLIE vdi read test2 | md5sum > /tmp/csum.21.new
+
+diff -u /tmp/csum.11.org /tmp/csum.11.new
+diff -u /tmp/csum.21.org /tmp/csum.21.new
+
+for i in `seq 0 3`; do
+ _kill_sheep $i
+ _wait_for_sheep_stop $i
+done
+
+_cleanup
+
+for i in `seq 0 3`; do
+ _start_sheep $i;
+done
+
+_wait_for_sheep 4
+
+$COLLIE cluster snapshot load s2 $TMPDIR
+
+$COLLIE vdi list | _filter_short_date
+
+$COLLIE vdi read -s 2 test1 | md5sum > /tmp/csum.12.new
+$COLLIE vdi read -s 2 test2 | md5sum > /tmp/csum.22.new
+
+diff -u /tmp/csum.12.org /tmp/csum.12.new
+diff -u /tmp/csum.22.org /tmp/csum.22.new
+
+$COLLIE vdi read test1 | md5sum > /tmp/csum.12.new
+$COLLIE vdi read test2 | md5sum > /tmp/csum.22.new
+
+diff -u /tmp/csum.12.org /tmp/csum.12.new
+diff -u /tmp/csum.22.org /tmp/csum.22.new
+
+$COLLIE vdi read -s 1 test1 | md5sum > /tmp/csum.11.new
+$COLLIE vdi read -s 1 test2 | md5sum > /tmp/csum.21.new
+
+diff -u /tmp/csum.11.org /tmp/csum.11.new
+diff -u /tmp/csum.21.org /tmp/csum.21.new
+
+rm -rf $TMPDIR
diff --git a/tests/030.out b/tests/030.out
new file mode 100644
index 0000000..0e7ca32
--- /dev/null
+++ b/tests/030.out
@@ -0,0 +1,29 @@
+QA output created by 030
+using backend plain store
+Index Tag Snapshot Time
+1 s1 DATE
+Index Tag Snapshot Time
+1 s1 DATE
+2 s2 DATE
+ Name Id Size Used Shared Creation time VDI id Copies Tag
+s test1 1 10 MB 12 MB 0.0 MB DATE fd32fc 3
+s test1 2 10 MB 12 MB 0.0 MB DATE fd32fd 3
+ test1 0 10 MB 0.0 MB 12 MB DATE fd32fe 3
+s test2 1 10 MB 12 MB 0.0 MB DATE fd3815 3
+s test2 2 10 MB 12 MB 0.0 MB DATE fd3816 3
+ test2 0 10 MB 0.0 MB 12 MB DATE fd3817 3
+using backend plain store
+using backend plain store
+ Name Id Size Used Shared Creation time VDI id Copies Tag
+s test1 1 10 MB 12 MB 0.0 MB DATE fd32fc 3
+ test1 0 10 MB 0.0 MB 12 MB DATE fd32fd 3
+s test2 1 10 MB 12 MB 0.0 MB DATE fd3815 3
+ test2 0 10 MB 0.0 MB 12 MB DATE fd3816 3
+using backend plain store
+ Name Id Size Used Shared Creation time VDI id Copies Tag
+s test1 1 10 MB 12 MB 0.0 MB DATE fd32fc 3
+s test1 2 10 MB 12 MB 0.0 MB DATE fd32fd 3
+ test1 0 10 MB 0.0 MB 12 MB DATE fd32fe 3
+s test2 1 10 MB 12 MB 0.0 MB DATE fd3815 3
+s test2 2 10 MB 12 MB 0.0 MB DATE fd3816 3
+ test2 0 10 MB 0.0 MB 12 MB DATE fd3817 3
--
1.7.1
More information about the sheepdog
mailing list