[sheepdog] [PATCH v3 12/12] test: add tests/030 for cluster snapshot

Kai Zhang kyle at zelin.io
Tue May 14 09:51:57 CEST 2013


Signed-off-by: Kai Zhang <kyle at zelin.io>
---
 tests/030     |   83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/030.out |   21 ++++++++++++++
 2 files changed, 104 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..398400c
--- /dev/null
+++ b/tests/030
@@ -0,0 +1,83 @@
+#!/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
+
+dd if=/dev/urandom | $COLLIE vdi write test1
+dd if=/dev/urandom | $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 $TMPDIR
+$COLLIE cluster snapshot list $TMPDIR | _filter_date
+
+dd if=/dev/urandom | $COLLIE vdi write test1
+dd if=/dev/urandom | $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 $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 $TMPDIR
+
+$COLLIE vdi list | _filter_short_date
+
+$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
+
+$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
+
+rm -rf $TMPDIR
diff --git a/tests/030.out b/tests/030.out
new file mode 100644
index 0000000..a3335c0
--- /dev/null
+++ b/tests/030.out
@@ -0,0 +1,21 @@
+QA output created by 030
+using backend plain store
+Index		Snapshot Time
+1		DATE
+Index		Snapshot Time
+1		DATE
+2		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              
+s test1        2   10 MB   12 MB  0.0 MB DATE   fd32fd     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              
-- 
1.7.1




More information about the sheepdog mailing list